from selenium import webdriver import time driver=webdriver.Chrome() driver.get("http://www.douban.com/") driver.find_element_by_xpath(‘//*[@id="anony-sns"]/div/div[3]/div/div[1]/ul/li[1]/div/a/img‘).click() time.sleep(3) driver.back() #后退 time.sleep(3) driver.forward() #前进