selenium 滚动到指定元素的位置
code
from selenium.webdriver.common.action_chains import ActionChains from selenium import webdriver driver = webdriver.Chrome() asleep(driver) driver.get("https://pan.baidu.com/") driver.maximize_window() x=driver.find_elements_by_xpath(".//dd[@_cmd_installed='1']") #滚动到指定元素 time.sleep(3) driver.execute_script("arguments[0].scrollIntoView();", x[90])