Quick Guide to Installing Selenium (Google Chrome version)

To set up Selenium, you must first have Python installed. I recommend installing Python 3 via Anaconda, which is detailed here. This will also give you the Spyder development environment, which I recommend as well.

Next, if you’re using Windows, open up your command prompt and type:

pip install selenium

or an equivalent command in Mac or Linux Terminal.

Now that Selenium is installed, you need to pick a web browser for Selenium to use. To get things up and running with the fewest possible errors, I recommend starting with Google Chrome. Firefox is my personal preference, but as things now stand there can be a few kinks with setting it up, so we’ll focus on Chrome for now. Assuming Chrome is installed, go to the following website:

https://sites.google.com/a/chromium.org/chromedriver/downloads

Follow the link to the latest release and download the appropriate driver for your machine. Unzip the driver and move it to whatever place in your file system you prefer. Just keep in mind you will need to reference the Chrome driver’s location when you use Selenium.

Finally, to make sure everything is working as it should, run this code:

from selenium import webdriver

## your executable path is wherever you saved the Chrome webdriver
browser = webdriver.Chrome(executable_path="C:UsersgstantonDownloadschromedriver.exe")
url = "https://www.google.com"
browser.get(url)

If a Chrome browser pops up and takes you to Google’s home page, you’re all set!