1from selenium import webdriver
2from selenium.webdriver.common.keys import Keys
3from bs4 import BeautifulSoup
4
5def parse_content(html_doc):
6 soup = BeautifulSoup(html_doc, 'html.parser')
7 print (soup.title.text)
8
9
10driver = webdriver.Chrome()
11driver.get("http://www.python.org")
12assert "Python" in driver.title
13elem = driver.find_element_by_name("q")
14elem.clear()
15elem.send_keys("pycon")
16elem.send_keys(Keys.RETURN)
17assert "No results found." not in driver.page_source
18html_doc = driver.page_source
19driver.close()
20parse_content(html_doc)