gpt4 book ai didi

python - 如何使用 Selenium 和 Python 绕过带有 buster 扩展的 ReCaptcha

转载 作者:行者123 更新时间:2023-12-03 19:09:18 24 4
gpt4 key购买 nike

目前,我使用 selenium 自动化了一些流程,需要解决 Google ReCaptcha。用于解决 ReCaptcha 的技术是浏览器 Plugin Buster。我使用以下输入 Google ReCaptcha

driver.switch_to.frame(driver.find_elements_by_tag_name("iframe")[0])
check_box = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, "recaptcha-anchor")))
check_box.click()
现在我使用以下命令切换回默认框架:
driver.switch_to.default_content()
所以我需要点击 Buster 图标,但是怎么做呢?
点击图标:
Icon to click

最佳答案

克星 图标在另一个同级中 <iframe> .所以你必须:

  • 切换回 default_content() .
  • 诱导 WebDriverWait 以使所需的帧可用并切换到它。
  • 诱导 WebDriverWait 使所需元素可点击。
  • 您可以使用以下 Locator Strategies :
  • 代码块:
    from selenium import webdriver
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support import expected_conditions as EC

    driver.switch_to.default_content()
    WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR,"//iframe[@title='recaptcha challenge']")))
    WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//button[@id='solver-button']"))).click()
  • 浏览器快照:

  • recaptcha_iframe

    引用
    您可以在以下位置找到一些相关的讨论:
  • How to interact with the reCAPTCHA audio element using Selenium and Python
  • How to send text to the Password field within https://mail.protonmail.com registration page?

  • 奥特罗
    Ways to deal with #document under iframe

    关于python - 如何使用 Selenium 和 Python 绕过带有 buster 扩展的 ReCaptcha,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62721327/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com