Home > Software engineering >  in until raise TimeoutException(message, screen, stacktrace)
in until raise TimeoutException(message, screen, stacktrace)

Time:10-14

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

CodePudding user response:

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/

  • Related