1浏览器最大化 maximize_window()
from selenium import webdriver driver = webdriver.Chrome() #浏览器最大化 driver.maximize_window() #关闭浏览器 driver.quit()
2设置浏览器的宽和高 set_window_size(宽,高)
from selenium import webdriver driver = webdriver.Chrome() #设置浏览器的宽和高 driver.set_window_size(500,900) driver.quit()
3访问网页 get()
from selenium import webdriver driver = webdriver.Chrome() #访问百度 driver.get("http://www.baidu.com/") driver.quit()
4浏览器后退 back()
#访问百度并搜索tynam,然后退回百度首页 from selenium import webdriver driver = webdriver.Chrome() import time driver.get("https://www.baidu.com/") time.sleep(3) dirver.find_elements_by_id('kw').send_keys('tynam') driver.find_elements_by_id('su').click() time.sleep(1) #操作浏览器后退 driver.back() driver.quit()View Code
标签:webdriver,浏览器,quit,Chrome,driver,import,操作 From: https://www.cnblogs.com/ddupfan/p/17469069.html