调过JS脚本控制
- from selenium import webdriver
- import time
- driver=webdriver.Firefox()
- driver.get("http://www.baidu.com")
- driver.find_element_by_id("kw").send_keys("selenium")
- driver.find_element_by_id("su").click()
- time.sleep(3)
- js="var q=document.documentElement.scrollTop=100000"
- driver.execute_script(js)
- time.sleep(3)
- js="var q=document.documentElement.scrollTop=0"
- driver.execute_script(js)
- time.sleep(3)
- js="var q=document.documentElement.scrollTop=50"
- driver.execute_script(js)
- time.sleep(999999)
- ‘‘
- driver.quit()
selenium_webdriver(python)控制浏览器滚动条
原文:http://www.cnblogs.com/liunaixu/p/7223675.html