提问者:小点点

Python Selenium 中的多个滚动条


我想使用python、selenium和chromedrive将左侧导航栏(显示作业列表)滚动到底部。我尝试使用:

_driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")

但什么也没发生。我是网络自动化的新手,如果你需要什么,请告诉我。

附页来源


共1个答案

匿名用户

这是左侧导航栏中的最后一个元素作业列表

(//li[contains(@class, 'PaEvOc')])[last()]

要滚动到左下方的导航,使用< code >。location _ once _ scrolled _ into _ view :

element = driver.find_element_by_xpath("(//li[contains(@class, 'PaEvOc')])[last()]")
element.location_once_scrolled_into_view