Can you please explain/break-down the following syntax on how 'scrollTop' works in Selenium-Python:
inner_window = driver.find_element(By.XPATH, "XPATH")
driver.execute_script('arguments[0].scrollTop = arguments[0].scrollTop +
document.getElementById("ID").scrollHeight;',
inner_window,)
Above code scrolls down directly to the bottom of the scroll bar and picks the values at the bottom, whereas I need to scroll through and pick values from top, middle and bottom of the page.
Also, how would I know when the bottom of the scroll is reached??
I also tried the below, but didn't work:
ht= driver.execute_script("return document.getElementById('ID').scrollHeight")
print(ht)
nht= ht//3
print(nht)
sht = str(nht)
inner_window = driver.find_element(By.XPATH, "XPATH")
for items in ree:
time.sleep(1)
wer=items.text.replace(' ','')
#print(wer)
arr1.append(wer)
driver.execute_script('arguments[0].scrollTop = arguments[0].scrollTop + '+sht+';',
inner_window,
)
time.sleep(10)
print(arr1)
