Selenium drivers downloader tool with standalone CLI support.
Selenium needs a specific driver to work with each browser. Every driver has a version that works with specific browser versions, and it's really annoying reading the changelogs to check if the current driver will work with the new browser version. Plus, a lot of times a test crashes because the browser has updated and the driver is not compatible anymore. That's why Driloader exists: To make this process so much easier! Driloader autodetect the browser version (it supports Chrome, Firefox and Internet Explorer) and download the driver according to it's version.
- Python 3.6 or higher
This project uses Pipenv as packaging tool. Please make sure you have it installed in your system.
Also, we use make as task runner, so you can see the available tasks by running make help
.
# Clone the project
bash: $ git clone https://github.com/lucasmello/Driloader.git
bash: $ cd Driloader
# Install dependencies
bash: $ make install
pipenv install --dev
Installing dependencies from Pipfile.lock…
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 20/20 — 00:00:03
# Active virtual env
bash: $ pipenv shell
source ~/.local/share/virtualenvs/driloader-ZPASDPNJ/bin/activate
# Run linter and tests
(driloader-ZPASDPNJ) driloader: $ make lint test
pip install driloader
from driloader import driloader
from selenium.webdriver import Firefox
driver_path = driloader.firefox().get_driver()
browser = Firefox(executable_path=driver_path)
browser.get("https://www.google.com")
browser.quit()
from driloader import driloader
from selenium.webdriver import Chrome
driver_path = driloader.chrome().get_driver()
browser = Chrome(executable_path=driver_path)
browser.get("https://www.google.com")
browser.quit()
from driloader import driloader
from selenium.webdriver import Ie
driver_path = driloader.internet_explorer().get_driver()
browser = Ie(executable_path=driver_path)
browser.get("https://www.google.com")
browser.quit()
If you don't provide the browser's binary, driloader will try to find the browser in common paths, and sometimes it's not possible to find the browser. You can set the binary like this:
from driloader import driloader
from selenium.webdriver import Chrome
driver_path = driloader.chrome().binary('/path/to/chrome').get_driver()
browser = Chrome(executable_path=driver_path)
browser.get("https://www.google.com")
browser.quit()
python -m driloader
usage: driloader [-h] (--firefox | --chrome | --internet-explorer | --all)
optional arguments:
-h, --help show this help message and exit
--firefox, -f get Firefox version.
--chrome, -c get Google Chrome version.
--internet-explorer, -i
get Internet Explorer version.
--all look for browsers an get their versions.
$ python -m driloader --firefox
45
$ python -m driloader --chrome
58
> python -m driloader -i
11
> python -m driloader --all
Internet Explorer: 11
Firefox: 45
Google Chrome: 58
# Getting from a non-Windows system
$ python -m driloader --all
Internet Explorer: Error: Unable to get the Internet Explorer version.
Cause: Error: Unable to retrieve IE version..
Cause: System is not Windows.
Firefox: 45
Google Chrome: 58
- Firefox will always download the latest version, that is compatible with Firefox >= 70.
- IEDriver will always download the latest version.