I have been trying to click an accept button in an iframe
, but I am unable to locate this iframe
with xpath
. I have checked similar SO posts but to no avail.
Selenium can't locate iframe, python selenium cant find iframe xpath
I have tried following so far.
wait.until(EC.frame_to_be_available_and_switch_to_it((By.ID,"pop-frame028142186741537767")))
gives TimeoutException
.
Also tried:
time.sleep(10)
driver.switch_to.frame(driver.find_element_by_xpath("//div[@class='truste_box_overlay']/div[@class='truste_box_overlay_inner']/iframe[@id='pop-frame028142186741537767']"))
Error
NoSuchElementException: Unable to locate element: //div[@class='truste_box_overlay']/div[@class='truste_box_overlay_inner']/iframe[@id='pop-frame028142186741537767']
Finding the the iframe
driver.find_elements_by_id('pop-frame028142186741537767')
gives an empty list. However, I am able to locate two parent div
elements with xpath
and class
attributes.
EDIT:
driver.find_elements_by_class_name('truste_box_overlay')
gives outermost div
element. But, accessing same element with id
driver.find_elements_by_id('pop-div20738421000570183')
gives empty list.
So, I suppose find_elements_by_id
not working?! How can I go about to solve this problem? I am not able to progress as without clicking this button I can't interact to the main content.