Bootstrap

Python 爬虫模拟登陆,破解滑块验证码_pyautogui 阿里滑块

res = cv2.matchTemplate(target_gray, template_rgb, cv2.TM_CCOEFF_NORMED)
# 获取最佳匹配位置
value = cv2.minMaxLoc(res)
# 返回最佳X坐标
return value[2][0]

打开FireFox浏览器

driver = webdriver.Firefox()
driver.get(“https://passport.jd.com/new/login.aspx”)
driver.find_element_by_xpath(‘/html/body/div[2]/div[2]/div[1]/div/div[3]/a’).click()
driver.find_element_by_xpath(‘//*[@id=“loginname”]’).send_keys(‘123456’)
driver.find_element_by_xpath(‘//*[@id=“nloginpwd”]’).send_keys(‘123456’)
driver.find_element_by_xpath(‘//*[@id=“loginsubmit”]’).click()

while True:
try:
# 从网页上获取组件
target = driver.find_element_by_xpath(‘/html/body/div[4]/div/div/div/div[1]/div[2]/div[1]/img’)
template = driver.find_element_by_xpath(‘/html/body/div[4]/div/div/div/div[1]/div[2]/div[2]/img’)
# 获取模块的url路径
src1 = target.get_attribute(“src”)
src2 = t

;