python_selenium简单的滑动验证码

一:背景图片

主要是解决这类简单的验证码,思路很简单,这里直接分享一下代码吧,以后可以直接拿来用

二:代码如下

    driver.get(url=url)
    # 开始查找滑块
    button = driver.find_element_by_xpath('//div[@class="ui-slider-btn init ui-slider-no-select"]')
    action = ActionChains(driver)
    action.click_and_hold(button).perform()
    action.reset_actions()
    action.move_by_offset(333, 0).release().perform()
    action.click_and_hold()

三:参考大神博客连接如下

https://www.cnblogs.com/chengming104/p/8746046.html
原文地址:https://www.cnblogs.com/fierydragon/p/11093216.html