from selenium.webdriver import ActionChains
driver.get("http://baidu.com")
link=driver.find_element_by_link_text('设置')
ActionChains(driver).move_to_element(link).perform()
driver.find_element_by_class_name('setpref').click()
driver.find_elements_by_tag_name('option')[1].click()
driver.find_element_by_id('nr').find_element_by_xpath('//option[@value="50"]').click()
sleep(5)
driver.quit()
#利用select类定位
from selenium.webdriver.support.ui import Select
sleep(3)
select = Select(driver.find_element_by_css_selector('[name="NR"]'))
sleep(2)
#select.select_by_index(1)
select.select_by_visible_text("每页显示20条")
select.select_by_value('50')
sleep(3)
driver.quit()
print("--完成--")