PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, April 15, 2022

[FIXED] How to bypass ReCaptcha with buster extension using Selenium and Python

 April 15, 2022     iframe, python, recaptcha, selenium, webdriverwait     No comments   

Issue

Currently, I automate some processes using selenium and need to solve Google ReCaptcha. The technology used to solve the ReCaptcha is the browser, Plugin Buster. I enter the Google ReCaptcha using the following

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()

Now I switch back to the default Frame using:

driver.switch_to.default_content()

So I need to click the Buster icon, but how to do that?

Icon to click:

Icon to click


Solution

The Buster icon is within another sibling <iframe>. So you have to:

  • Switch back to the default_content().

  • Induce WebDriverWait for the desired frame to be available and switch to it.

  • Induce WebDriverWait for the desired element to be clickable.

  • You can use the following Locator Strategies:

  • Code Block:

    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()
    
  • Browser Snapshot:

recaptcha_iframe


Reference

You can find a couple of relevant discussions in:

  • 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?

Outro

Ways to deal with #document under iframe



Answered By - undetected Selenium
Answer Checked By - Clifford M. (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing