# -*- coding: UTF-8 -*-
from selenium import webdriver
from time import sleep
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.action_chains import ActionChains
import os
driver=webdriver.Firefox()
driver.get('http://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()
m=driver.find_element_by_name('NR')
m.find_element_by_xpath("//option[@value='50']").click()
sleep(2)
#click一直报错换成submit跳过了
driver.find_element_by_xpath('//*[@id="gxszButton"]/a[1]').submit()
# t=driver.switch_to_alert()
# print(t.text)
# #点击确定
# t.accept()
driver.find_element_by_id("kw").send_keys(u'新闻')
driver.find_element_by_id("su").click()
sleep(1)
driver.quit()