0

So, I am using selenium and chromedriver in python to automate some tasks. I need to wait for an iframe that gets created upon clicking a button. The issue is that when I use WebDriverWait and EC to wait until the iframe becomes present, it times out.

...code...

try:
    WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH,"//iframe[@id='x'|@id='y'|@id='z']")))
except:
    print ("iframe not loaded")

But when I test using just....

EC.presence_of_element_located((By.XPATH,"//iframe[@id='x'|@id='y'|@id='z']"))

...the element gets found.

Even using..

driver.find_elements_by_xpath("//iframe[@id='x'|@id='y'|@id='z']")

..works!

What am I doing wrong in the try-except block to prevent the element from being found?

0 Answers0