标签:selenium click 对象 com document exe scroll driver end
#encoding=utf-8
from selenium import webdriver
import time,os
driver = webdriver.Chrome()
#打开网页
driver.get(‘https://www.baidu.com/‘)
driver.maximize_window()
input_box = driver.find_element_by_id("kw").send_keys(‘selenium‘)
driver.find_element_by_id("su").click()
time.sleep(3)
# 将页面滚动条拖到底部
js = "var q=document.body.scrollTop=100000"
driver.execute_script(js)
time.sleep(3)
# 将滚动条移动到页面的顶部
js = "var q=document.body.scrollTop=0"
driver.execute_script(js)
time.sleep(3)
# 将滚动条移动到页面的任意位置
js = "var q=document.body.scrollTop=500"
driver.execute_script(js)
time.sleep(3)
标签:selenium click 对象 com document exe scroll driver end
原文地址:http://www.cnblogs.com/yan-xiang/p/6618930.html