0

I am trying to get to the iframe on this page: https://www.google.com/recaptcha/api2/demo. this is the iframe with images that you have to click. iframe shows up then you click on the "i'm not a robot" button. you have to use selenium for this to work, it won't work if you do it manually in chrome.

code:

from selenium import webdriver

driver = webdriver.Chrome()
driver.get('https://www.google.com/recaptcha/api2/demo')
iframe = driver.find_element_by_xpath('//*[@id="recaptcha-demo"]/div/div/iframe')
driver.switch_to.frame(iframe)
driver.find_element_by_class_name('recaptcha-checkbox').click()
#choose new iframe with pictures - doesn't work
iframe = driver.find_element_by_xpath('/html/body/div[2]/div[4]/iframe')

what is the problem here? tnx, vasja

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
leeon
  • 51
  • 2
  • 8
  • Whatever you're imagining won't work. Are you thinking you can click on the streetlights / crosswalks programatically? – pguardiario Jan 13 '20 at 09:35
  • 1
    @pguardiario _... click on the streetlights / crosswalks programatically..._ is not a part of the OP's question either, as you are speculating. Please give a chance to the contributors to learn how to handle elements with in ` – undetected Selenium Jan 13 '20 at 09:44
  • 1
    @pguardiario Please read the question again. The question heading is loud and clear **find iframe on google captcha test page with python selenium** but not to bypass **google captcha**. OP's requirement and your visibility are miles apart. – undetected Selenium Jan 13 '20 at 11:05
  • there's no iframe on the page you linked to... Just a note that when using Selenium, the captcha will keep re-displaying endlessly. (you can't solve it) – pcalkins Jan 13 '20 at 19:27

0 Answers0