1
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

1 Answer 1

1

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/

Sign up to request clarification or add additional context in comments.

2 Comments

that's exactly it, thank you mate <3
No worries @Shawn

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.