Selenium_界面的刷新、后退、前进操作(4)
import time from selenium import webdriver driver = webdriver.Chrome() driver.maximize_window() driver.get("https://www.baidu.com") driver.find_element_by_id("kw").send_keys("selenium") driver.find_element_by_id("su").click() # 刷新界面 driver.refresh() time.sleep(1) # 界面后退 driver.back() time.sleep(1) # 界面前进 driver.forward() time.sleep(1) driver.close()