Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98819

Bit by bit horizontal scrolling till element is found

$
0
0

enter image description hereI would like to perform horizontal scrolling till my element is found and once found I have to update the value in the field.

period = Nov-26ele_xpath ="//div[1]/div[@col-id='{0}']/div/span".format(period)elem_not_found = Truey= 10  # setting initial scroll pixel size to 10  while elem_not_found:    try:   driver.execute_script("window.scrollTo(0,document.body.scrollHeight)")        time.sleep(1)        driver.execute_script("window.scrollBy(2000,0)")        time.sleep(2)        ele =driver.find_element(By.XPATH,xpath)        driver.execute_script("arguments[0].scrollIntoView();", ele)        time.sleep(2)        elem_not_found = False    except:    y += 35

attached is screen shot how landing page looks like.. Thank you , Team in advance.

enter image description here


Viewing all articles
Browse latest Browse all 98819

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>