Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

in until raise TimeoutException(message, screen, stacktrace)

WebDriverWait(driver,20).until(EC.element_to_be_clickable((By.NAME, "username"))).send_keys("AHHHH")


WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR,"iframe[name^='a-'][src^='https://www.google.com/recaptcha/api2/anchor?']")))
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//span[@id='recaptcha-anchor']"))).click()


WebDriverWait(driver,20).until(EC.element_to_be_clickable((By.NAME, "username"))).send_keys("AHHHH")

My first ((By.NAME, "username"))).send_keys("AHHHH") works just fine however after I click the recaptcha on the page, I suddenly get the error:

 File "/opt/homebrew/lib/python3.10/site-packages/selenium/webdriver/support/wait.py", line 90, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: 

I’m really not too sure what to do, I’ve tried a lot of things including switching from name to xpath for the find and I’m just lost

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

After doing stuffs in iframe, you need to get out of it if you want to interact with elements from the actual page:

driver.switch_to.default_content()

Selenium documentation: https://www.selenium.dev/documentation/

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading