使用 Selenium 将滚动条移动到目标元素位置的方法

来源:互联网 发布:java编程思想pdf超清版 编辑:程序博客网 时间:2024/06/16 04:11
from selenium.webdriver.common.action_chains import ActionChainsscroll_add_crowd_button = driver.find_element_by_xpath(xpath_button_add_crowd)driver.execute_script("arguments[0].scrollIntoView();", scroll_add_crowd_button)

scroll_add_crowd_button 表示目标元素


js 脚本法

js="document.getElementById('id').scrollTop=10000"driver.execute_script(js)
阅读全文
0 0
原创粉丝点击