Home > database >  Selenium Webdriver cannot find element which loads later than DOM
Selenium Webdriver cannot find element which loads later than DOM

Time:06-09

I've been trying to webscrap devtoolsandplanespottsersite

For selenium switch to your iframe first - this finds the iframe wher the url contains 'privacy':

WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.XPATH,"//iframe[contains(@src,'privacy')]")))

Then you can complete your action. Be sure to keep that sync in there too.

Then you can switch back to your main window and carry in with your test

driver.switch_to_default_content()

CodePudding user response:

You can try introducing an implicit wait for your driver. This will happen once per script and will affect all objects. This will wait 10 seconds before throwing an error, or continues whenever it is ready:

driver.implicitly_wait(10)
  • Related