验证码破解全家桶滑动验证码、数字验证码、极验验证码

一、滑动验证码:(以企查查为例)

from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver import ActionChains
from selenium.webdriver.support.ui import webdriverwait
#滑块验证
def validation():
    button_status = is_element_exist('nc_1_n1z')  # 按钮状态
    if button_status:
        button = webdriverwait(driver, timeout=10, poll_frequency=0.5).until(
            lambda x: x.find_element_by_id('nc_1_n1z'),
            message='按钮定位超时')
    else:  # 滑动失效
        button = webdriverwait(driver, timeout=10, poll_frequency=0.5).until(
            lambda x: x.find_element_by_id('nc_2_n1z'),
            message='按钮定位超时')
    # 滑动滑块
    ActionChains(driver).click_and_hold(button).perform()
    ActionChains(driver).move_by_offset(xoffset=263, yoffset=0).perform()  #263是滑动距离坐标,可从源码算出
    ActionChains(driver).release().perform()
    time.sleep(1)

二、数字字母验证码(以知乎为例)

相关文章

转载地址:https://www.cnblogs.com/mini-monkey/p/12104821...
web自动化测试过程中页面截图相对比较简单,可以直接使用sel...
目录前言一、Selenium简介二、浏览器驱动1.浏览器驱动参考2....
一、iframe的含义:iframe是HTML中框架的一种形式,在对界面...
转载请注明出处❤️作者:测试蔡坨坨原文链接:caituotuo.to...
'''##**认识selenium**​**下载:pipinstall...