import time
from selenium import webdriver
from selenium.webdriver.common.by import By
driver=webdriver.Chrome()
driver.get('http://www.huangjinjiage.cn/talk/20211208/13752.html')#打开对应的网站
driver.maximize_window()#浏览器最大
xpath='/html/body/div[3]/div[2]/div[1]/div[2]/ul/li[1]/a'
driver.find_element(By.XPATH,xpath).click()
driver.back()#浏览器后退
time.sleep(3)
driver.forward()#浏览器前进
time.sleep(3)
driver.refresh()#浏览器刷新
print(driver.title)#获取浏览器标题
print(driver.current_url)#获取浏览器网站
driver.close()#关闭当前窗口
driver.quit()#退出当前浏览器标签:浏览器,selenium,driver,sleep,操作,import,div From: https://www.cnblogs.com/cyq0528/p/18087832