import time
from selenium import webdriver
driver = webdriver.Chrome()
url = 'https://www.baidu.com/'
driver.get(url)
driver.maximize_window()
time.sleep(2)
el_set = driver.find_element_by_id('s-usersetting-top')
el_set.click()
time.sleep(2)
el_search = driver.find_element_by_class_name('setpref')
el_search.click()
time.sleep(2)
el_save = driver.find_element_by_xpath('//*[@id="se-setting-7"]/a[2]')
el_save.click()
time.sleep(5)
driver.switch_to.alert.accept()
time.sleep(5)
driver.quit()
转载请注明原文地址:https://blackberry.8miu.com/read-33708.html