#code:utf-8
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.select import Select
from time import sleep
driver=webdriver.Firefox()
driver.get("https://www.baidu.com")
#点击搜索设置
sz=driver.find_element_by_xpath('//*[@id="u1"]/a[8]')
ActionChains(driver).move_to_element(sz).perform()
driver.find_element_by_link_text("搜索设置").click()
sleep(3)
#select选择框操作
se=driver.find_element_by_id('nr') Select(se).select_by_value('50')
#保存设置
sleep(2)
driver.find_element_by_xpath('//*[@id="gxszButton"]/a[1]').click()
t=driver.switch_to_alert()
print(t.text)
#点击确定
t.accept()
driver.quit()