from selenium import webdriver
import time
driver = webdriver.Chrome()
time.sleep(3)
url = 'http://www.baidu.com'
driver.get(url)
driver.find_element_by_id('kw').send_keys("范冰冰")
driver.find_element_by_id('su').click()
time.sleep(2)
with open('baidu.html','wb') as f:
f.write(driver.page_source.encode('utf-8'))
# print(driver.page_source)