Feb-18-2018, 01:12 AM
(This post was last modified: Feb-18-2018, 01:13 AM by digitalmatic7.)
There's dynamically loaded iframe content 3/4 the way down, towards the bottom of the webpage. It only loads once I scroll close to it. I need this snippet to scroll down in small increments until the element exists.
Here's my code:
Here's my code:
from selenium.common.exceptions import NoSuchElementException
loop_counter = 0
while loop_counter == 0:
driver.execute_script("window.scrollTo(0, 500)")
sleep(1)
try:
driver.find_element_by_xpath('//IFRAME[contains(@src, "https://myiframe.com/id?=")]')
except NoSuchElementException:
pass
if driver.find_element_by_xpath('//IFRAME[contains(@src, "https://myiframe.com/id?=")]').is_displayed():
loop_counter = 1Any ideas where I'm screwing up?
