Several browsers/drivers are supported (Firefox, Chrome, Internet Explorer, PhantomJS), as well as the Remote protocol.

Supported Python Versions

Python 2.6, 2.7

Python 3.3+

Installing

If you have pip on your system, you can simply install or upgrade the Python bindings:

pip install -U selenium

Alternately, you can download the source distribution from PyPI (e.g. selenium-3.7.0.tar.gz), unarchive it, and run:

python setup.py install

Note: both of the methods described above install selenium as a system-wide package That will require administrative/root access to their machine. You may consider using a virtualenv to create isolated Python environments instead.

Drivers

Selenium requires a driver to interface with the chosen browser. Firefox,
for example, requires geckodriver, which needs to be installed before the below examples can be run. Make sure it’s in your PATH, e. g., place it in /usr/bin or /usr/local/bin.

Failure to observe this step will give you an error selenium.common.exceptions.WebDriverException: Message: ‘geckodriver’ executable needs to be in PATH.

Other supported browsers will have their own drivers available. Links to some of the more popular browser drivers follow.