How to use Selenium with Python?

We can use Selenium with Python. First, we have to install Python in our system. Navigate to the link: Click on Download Python <version>.

Based on our operating system, we have the options to download Python on Windows, Linux/Unix, Mac, and so on. After clicking the button, the Python executable file needs to be saved to a location.

Then click on Install Now and proceed with the installation process.

As the installation is done, the Python gets downloaded in the following location −


Next, we have to set the location of the Python folder in the Environmental variables. Also, the path of the Scripts folder inside the Python folder created in our system, needs to be set in the Environmental Variables.

To check if Python is successfully installed, run the command −

python −version

Next, we should have the Selenium bindings in our system. We have to get the PIP packages for that. Run the command −

pip install selenium

Once this command runs successfully, we shall have a new folder selenium created inside the Python folder in our system.

To upgrade the current package version, run the command −

pip install −U selenium

To check if Selenium is installed successfully, run the command −

pip show Selenium

Updated on: 30-Jan-2021


Kickstart Your Career

Get certified by completing the course

Get Started