Selenium 入門到精通系列python
PS:控制瀏覽器窗口大小、前進、後退、刷新web
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2019-04-23 16:12:33
# @Author : BenLam
# @Link : https://www.cnblogs.com/BenLam/
from selenium import webdriver
driver=webdriver.Firefox()
one_url='http://www.baidu.com'
#訪問百度首頁
driver.get(one_url)
#設置瀏覽器寬500,高800
driver.set_window_size(500,800)
#訪問hao123
two_url='http://www.hao123.com/'
driver.get(one_url)
#後退到百度首頁
driver.back();
#前進到hao123
driver.forward()
#刷新當前頁面
driver.refresh()
driver.quit()