So, I am trying to scroll down till a certain text appears using the following code, however as soon as I go to page the driver quits, with the following code.
def scroll_wait():
wait = WebDriverWait(driver, 10)
find_elem = None
scroll_from = 0
scroll_limit = 3000
while not find_elem:
sleep(2)
driver.execute_script("window.scrollTo(%d, %d);" % (scroll_from, scroll_from + scroll_limit))
scroll_from += scroll_limit
try:
find_elem = wait.until(EC.presence_of_element_located((By.XPATH, "//h3[@class='uiHeaderTitle']")))
except TimeoutException:
pass
driver.close()
I'm also trying with the following XPATH, but it just keeps on scrolling even after the text,
(By.XPATH, "//*[contains(text(), 'More About You')]")
And this is the HTML code for the text I am trying to scroll to.
<h3 class="uiHeaderTitle">More About You</h3>
presence_of_element_locatedwill return true if it is in the DOM, that means it is not necessary visible, this might be the reason for it to quit immediately. Try changing tovisibility_of_element_located