Selenium with Python Tutorial 1- Installing Python, Selenium and Pycharm IDE

Ayush Srivastava
4 min readMay 15, 2021

Selenium is an open source and free automated testing framework used to test different web based applications. It supports different languages like Java, Python, Ruby, C# etc.

Selenium consists of set of tools each having its own working activity. Here are the tools:

· Selenium IDE : It is a run and record tool. It is available as plugin which you can add through your web browser.

· Selenium Remote Control(RC): It allows users to choose programming languages among Java, Python, Ruby, Perl, C# to write the test cases.

· Selenium Webdriver : It allows users to perform cross- browser testing.

· Selenium Grid : It allows users to run multiple tests parallely on different browsers at the same time.

As we discussed about what exactly Selenium is and what are the tools it comprised of, we even discussed Selenium can support multiple programming languages but in this tutorial, we will discuss Selenium with Python.

Before starting, Let’s discuss some about Python.

Python is an interpreted, dynamically typed and general purpose programming language. Python was developed by Guido van Rossum, released in 1991. Python consists of large standard libraries that are used in almost every working domain.

Here are some of the key areas where Python are being used:

· Web Development

· Computer Networking

· Game Development

· Scientific Computing

· Automation

· Machine Learning

· Image Processing

· Mobile App Development

Why Python ?

If you want to do Automation testing, you have to know some programming knowledge and specially the languages which Selenium supports. Languages like Java, C#, Ruby, Python are some which are in great demand in market. But here I will tell you why choose Python over these languages ?

Here are the reasons :

· Understandability and easy to read

· Large sets of testing frameworks- Unittest, PyTest, Behave, Nose, Robot and Testify

· Package Installing is easy using pip command

· Wide range of IDEs — Pycharm, Notepad++, VSCode etc.

· Integration is very easy with CI/CD tools

Let’s start. Here are the steps we will follow :

· Installing the Python

· Installing Selenium with Python

· Configure Pycharm with Selenium

  1. Installing the Python

You can install the latest version of Python for Windows, MAC and Linux from here:

👉 https://www.python.org/downloads/

After installing python, you can verify its installation by going through your specified download location, open it using command prompt and type Python. It will look like this:

2) Installing Selenium with Python

You can install selenium by using the following command : pip install –U selenium

As you can see I already downloaded Selenium, that’s why it is showing as “Requirement already Satisfied”.

3) Pycharm Configuration

After installing Python and Selenium, we have to configured the same in Pycharm. You can install Pycharm from here :

👉 https://www.jetbrains.com/pycharm/download/#section=windows

Here there are two options available: Professional and Community. I will recommend you to install Community version which is free for all.

After downloading the Pycharm, open it.

· For configuring Selenium in Pycharm, go to

File- > Settings-> Project-> Project Interpreter

· Click on Right top ‘+’ button, type ‘Selenium’ in search bar and then click on ‘Install Package’.

· After installation, a message will appear ‘ Package ‘selenium’ installed successfully,

· Now create a new project, goto File-> New Project,, and give some name to project.

Here you can see, I have already installed Selenium in Pycharm.

Note -> Remember each time you create a new project, you have to installed the necessary packages.

Conclusion

Selenium is one of the most widely used automation tool in the market as it is open source and free. Selenium with Python is a very good option for people who are new in Automation testing and I would recommend you all because personally it’s time favourite.

If you are facing any issue while installation, please do let me know in comment section.

Thanks for the reading to the end. Hope you enjoyed this article . 😊

--

--