设置浏览器窗口大小
from selenium import webdriver
driver = webdriver.Chrome()
driver.set_window_size(400, 500) #宽400 ,高500显示
driver.maximize_window() #全屏显示
控制浏览器前进/后退
from selenium import webdriver
driver = webdriver.Chrome()
URL1 = 'http://www.baidu.com'#百度首页
driver.get(URL1)
URL2 = 'http://news.baidu.com/' #百度新闻
driver.get(URL2)
#返回到首页
driver.back()
#回到新闻
driver.forward()
#关闭
driver.quit()
刷新
from selenium import webdriver
import time
driver = webdriver.Chrome()
driver.get('http://www.baidu.com')
time.sleep(3) #等三秒,方便展示
driver.refresh() #刷新