问题
I am parsing the HTML of a website and I want selenium to scroll down to all the elements containing '5 days ago'. This is the code I have:
element = driver.find_elements_by_xpath(u"//*[contains(text(), '5 days ago')]")
for e in element:
driver.execute_script("arguments[0].scrollIntoView();", element)
time.sleep(SCROLL_PAUSE_TIME)
if element=='5 days ago':
break
It is not scrolling. Can someone help me with what I am doing wrong?
Thanks
来源:https://stackoverflow.com/questions/54308539/scrollintoview-is-not-scrolling-to-element-python