python3 selenium通过百度搜索

#coding:utf-8
import selenium
import selenium.webdriver
import selenium.webdriver.common.keys
import time

driver = selenium.webdriver.Firefox()
driver.get('https://baidu.com')
element = driver.find_element_by_id('kw')
element.send_keys('极光推送')
element.send_keys(selenium.webdriver.common.keys.Keys.RETURN)
time.sleep(3)
driver.quit()

推荐阅读更多精彩内容