SeleniumBase/help_docs/webdriver_installation.md

4.2 KiB
Executable File

Installing webdrivers

To run web automation, you'll need webdrivers for each browser you plan on using. With SeleniumBase, drivers are downloaded automatically as needed into the SeleniumBase drivers folder.

You can also download drivers manually with these commands:

sbase get chromedriver
sbase get geckodriver
sbase get edgedriver
  • sbase get chromedriver automatically tries to detect the version you need. If it can't, it defaults to chromedriver 72.0.3626.69 for compatibility reasons. To force getting the latest version, use:
sbase get chromedriver latest
  • You can also get a specific version of chromedriver for a specific version of Chrome:
sbase get chromedriver 102.0.5005.61

sbase get chromedriver 102
  • On Linux, you can run the following two commands (once you've installed SeleniumBase) to automatically upgrade your Chromedriver to match your version of Chrome: (wget downloads the file, and pytest runs it.)
wget https://raw.githubusercontent.com/seleniumbase/SeleniumBase/master/examples/upgrade_chromedriver.py
pytest upgrade_chromedriver.py -s
  • If you run a test without the correct webdriver available, the driver will be downloaded automatically.

If you plan on using the Selenium Grid integration (which allows for remote webdriver), you'll need to put the drivers on your System PATH. On macOS and Linux, /usr/local/bin is a good PATH spot. On Windows, you may need to set the System PATH under Environment Variables to include the location where you placed the driver files. As a shortcut, you could place the driver files into your Python Scripts/ folder in the location where you have Python installed, which should already be on your System PATH.

Here's where you can go to manually get web drivers from the source:

macOS shortcuts:

brew install --cask chromedriver

brew install geckodriver

You can also upgrade existing webdrivers:

brew upgrade --cask chromedriver

brew upgrade geckodriver

Linux shortcuts:

If you still need the web drivers, here are some scripts to help you get chromedriver and geckodriver on a Linux machine:

wget https://chromedriver.storage.googleapis.com/72.0.3626.69/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
mv chromedriver /usr/local/bin/
chmod +x /usr/local/bin/chromedriver
wget https://github.com/mozilla/geckodriver/releases/download/v0.31.0/geckodriver-v0.31.0-linux64.tar.gz
tar xvfz geckodriver-v0.31.0-linux64.tar.gz
mv geckodriver /usr/local/bin/
chmod +x /usr/local/bin/geckodriver