I have this could which should check if a iframe is available and swithes to it. Then I have this piece of code that check if a certain element is present.
WebDriverWait(driver, 20).until(EC.frame_to_be_available_and_switch_to_it((By.XPATH, '//*[@id="stageFrame"]')))
try:
WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.XPATH, '//*[@id="home_video_js"]')))
except NoSuchElementException:
print("No video located")
I'm not sure why I still get the error:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="stageFrame"]"}
Probably I'm missing something important but I don't know.