python,selenium 控制頁面滾動條的幾種方法

1/控制滾動條滾動多少距離

js="var q=document.documentElement.scrollTop="+size
    driver.execute_script(js)

2/控制滾動條滾動到某個元素位置

ac = driver.find_element_by_class_name('declare-original')
driver.execute_script("arguments[0].scrollIntoView();", ac)

3/發送tab鍵

driver.find_element_by_class_name('declare-original').send_keys(Keys.TAB)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章