How to install selenium for Python

Install selenium via pip:

pip install selenium


Drivers:

Selenium requires a driver to interface with the chosen browser. For example, Google Chrome requires chromedriver to be installed before running selenium programs. Download the zip file according to your web browser and extract the zip file. You will get a .exe file on extracting the zip. Make sure to keep the .exe file within the same folder where you are going to write the selenium code.

Failure to observe this step will give you an error selenium.common.exceptions.WebDriverException: Message: ‘chromedriver’ 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.

Chrome:https://chromedriver.chromium.org/downloads
Edge:https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
Firefox:https://github.com/mozilla/geckodriver/releases
Safari:https://webkit.org/blog/6900/webdriver-support-in-safari-10/