Python Selenium 中的多个滚动条

Mah*_*pta 6 python selenium automation google-chrome selenium-chromedriver

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

_driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
Run Code Online (Sandbox Code Playgroud)

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

PS页面来源

页面图片

fri*_*anH 2

job list这是左侧导航栏中的最后一个元素:

(//li[contains(@class, 'PaEvOc')])[last()]
Run Code Online (Sandbox Code Playgroud)

要实现滚动到左下导航,请使用.location_once_scrolled_into_view

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