Quick Guide to Installing Selenium (Firefox version)


To set up Selenium, you’ll first need to have Python installed. Check out my other posts if you need help with that.

Next, you need to install Selenium. To do this, simply open up your Windows command prompt or Mac/Linux terminal and type:

pip install selenium

Now that Selenium is installed, you need to pick a web browser for Selenium to use. Firefox and Chrome are both just as easy to use with Selenium, but here we’ll look at using Firefox. Assuming you have the Firefox browser installed on your machine, go to the following webpage:

https://github.com/mozilla/geckodriver/releases

Click to download the appropriate “gecko driver” zip file 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 gecko 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 gecko webdriver
geckodriver = "C:UsersgstantonDownloadsgeckodriver.exe"
browser = webdriver.Firefox(executable_path=geckodriver)

url = "https://www.duckduckgo.com"
browser.get(url)

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

If something’s not working, make sure Selenium, Firefox, and gecko driver are all up-to-date and try again. If all else fails, leave a comment and we’ll figure it out.

One thought to “Quick Guide to Installing Selenium (Firefox version)”

Comments are closed.