
The driver.page_source will return the full page HTML code. Chrome(options =options, executable_path =DRIVER_PATH) To install the Selenium package, as always, I recommend that you create a virtual environment (for example using virtualenv) and then:įrom import Options We will use Chrome in our example, so make sure you have it installed on your local machine:

In this case, Selenium might be what you need. Plus you haven't found an easy way to directly call the underlying APIs. Let's say that you want to scrape a Single Page Application. It is also useful for executing Javascript code. Selenium is useful when you have to perform an action on a website such as: And of course, it us used for web scraping! Now it is still used for testing, but it is also used as a general browser automation platform. The browser can run either localy or remotely.Īt the beginning of the project (almost 20 years ago!) it was mostly used for cross-browser, end-to-end testing (acceptance tests).

The Selenium API uses the WebDriver protocol to control a web browser, like Chrome, Firefox or Safari. It supports bindings for all major programming languages, including our favorite language: Python. Selenium refers to a number of different open-source projects used for browser automation. Today we are going to take a look at Selenium (with Python ❤️ ) in a step-by-step tutorial.
#Webscraper chrome image how to#
In the last tutorial we learned how to leverage the Scrapy framework to solve common web scraping problems.
