Python Web Scraping Cookbook
上QQ阅读APP看书,第一时间看更新

How it works

The primary difference in this recipe is the following code:

driver = webdriver.Firefox()
driver.get(url)

This gets the Firefox driver and uses it to get the content of the specified URL.  This works by starting Firefox and automating it to go the the page, and then Firefox returns the page content to our app.  This is why Firefox popped up.  The other difference is that to find things we need to call find_element_by_xpath to search the resulting HTML.