最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Python 點(diǎn)擊指定位置驗(yàn)證碼破解的實(shí)現(xiàn)代碼

 更新時間:2019年09月11日 10:28:37   作者:qq_42956206  
這篇文章主要介紹了Python 點(diǎn)擊指定位置驗(yàn)證碼破解的實(shí)現(xiàn)代碼,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

思路:

創(chuàng)建瀏覽器驅(qū)動對象

加載登錄頁面

等待頁面加載完畢

切換到用戶名和密碼登錄模式

輸入手機(jī)號, 注意此處需要等待并獲取輸入框

輸入密碼

點(diǎn)擊驗(yàn)證按鈕

獲取彈出驗(yàn)證圖片

使用超級鷹打碼平臺識別圖形的坐標(biāo)

獲取到坐標(biāo)信息, x,y坐標(biāo)分別除以2; 由于電腦分辨率太過了, 是原來的兩倍, 如果是普通分辨率可以除以2,直接用就可以了.

把鼠標(biāo)移動到, 坐標(biāo)點(diǎn)的位置進(jìn)行點(diǎn)擊

點(diǎn)擊登錄按鈕

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver import ActionChains

import time
# 導(dǎo)入超級鷹
from chaojiying import chaojiying
#根據(jù)系統(tǒng),可能截圖不成功,需要使用無頭瀏覽,mac系統(tǒng)可以不設(shè)置
options=webdriver.ChromeOptions()
options.headless=True

driver=webdriver.Chrome(options=potions)
driver.get('http://www.zhaopingou.com/signin')


driver.find_element_by_class_name('li02').click()
wait=WebDriverWait(driver,20,0.5)
# 賬號登錄
login_phone=wait.until(EC.visibility_of_element_located((By.ID,'pwd_login_phone')))
login_phone.send_keys('17724035140')
# 密碼
driver.find_element_by_id('form_login_password').send_keys('961831740hzll')
# 點(diǎn)擊獲取圖片
captcha = wait.until(EC.visibility_of_element_located((By.XPATH, '//div[@class="phone_login_pwd"]//iframe[starts-with(@id, "captcha_widget")]')))
captcha.click()
# 點(diǎn)擊
# 保存圖片(可以不保存)
captcha_element = wait.until(EC.visibility_of_element_located((By.XPATH, '//body[@class="graybc"]//iframe[starts-with(@id, "captcha_frame")]')))
captcha_element.screenshot('zhaopingou.png')

# 將圖片轉(zhuǎn)換為二進(jìn)制
bytes_img=captcha_element.screenshot_as_png
# print(bytes_img)

result=chaojiying.post_pic(bytes_img,'9101')
x,y=result['pic_str'].split(',')
print(x,y)
x=int(x)
y=int(y)
# ActionChains(driver).move_to_element_with_offset(bytes_img,x,y).click().perform()
ActionChains(driver).move_to_element_with_offset(captcha_element, x, y).click().perform()
time.sleep(2)
driver.find_element_by_id('free_login_btn').click()

print(driver.window_handles)
driver.switch_to.window(driver.window_handles[0])
# time.sleep(5)
driver.quit()

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

论坛| 宕昌县| 桐柏县| 腾冲县| 中宁县| 马山县| 德兴市| 平邑县| 承德县| 平昌县| 鄢陵县| 子长县| 莱州市| 雷波县| 奉化市| 祥云县| 霍林郭勒市| 馆陶县| 宁都县| 周口市| 无为县| 开封市| 全州县| 临高县| 宁海县| 义乌市| 颍上县| 阳泉市| 公安县| 马边| 佛山市| 郯城县| 运城市| 宜兰市| 东源县| 曲沃县| 彭山县| 巨鹿县| 浦城县| 石棉县| 永寿县|