[Python] How to bypass slider captcha to solve puzzle using selenium?(Python)

Discussão em 'Python' iniciado por Stack, Abril 17, 2025.

  1. Stack

    Stack Membro Participativo

    On the mentioned website, After searching for the token, a slider captcha appears.

    An example of the captcha: [​IMG]

    I want to bypass the slider captcha. I took reference from the first solution in Unable to let my script slide a button to the right

    My approach would be to slowly move until the slider is in the right place and after that, the new page opens.

    The website is: https://www.ems.com.cn/english/

    My approach:

    from selenium import webdriver
    from webdriver_manager.chrome import ChromeDriverManager
    import time
    from selenium.webdriver import ActionChains

    driver = webdriver.Chrome(ChromeDriverManager().install())
    actions = ActionChains(driver)

    url = 'https://www.ems.com.cn/english/'

    driver.get(url)

    token = 'CY008445045CN'

    token_space = driver.find_element_by_xpath("//input[@class='el-input__inner']")

    token_space.send_keys(token)
    driver.find_element_by_xpath("//i[@class='el-icon-search']").click()
    time.sleep(4)

    slider_container = driver.find_element_by_xpath("//div[@class='slide-verify-slider']")
    slider = driver.find_element_by_xpath("//div[@class='slide-verify-slider-mask-item']")

    # Perform sliding action
    actions.move_to_element(slider).click_and_hold().move_by_offset(slider_container.size['width'], 0).release().perform()

    Continue reading...

Compartilhe esta Página