Javatpoint Logo
Javatpoint Logo

Selenium Python Tutorial

Selenium with Python Tutorial

In this tutorial, we will learn how to run a Selenium test script using Python Programming language.

Generally, the testing process is termed as the crucial phase in the software development lifecycle. Because, the main objective of this phase is to ensure the given process is having any errors, bugs, etc and bug-free software that can meet the expectations of the customer requirements. Testing process is very much complicated because there are many manual executions takes place at the same time. But if this process become automated then testing process will be easier and this can be done using selenium tool.

Before starting the tutorial, we will know what are the essential points of the selenium and how to implement a selenium test script using Python. Below are some important points to implement the selenium test script.


What is Selenium?

Selenium is a testing tool that is used for the testing purpose. It is an open-source testing tool, which means the testing tool is available in the internet and we can directly download it from it and we don't need to spend anything for this tool. Selenium is a free automated testing framework which is used to test and validate web applications across various platforms and browsers. We can utilize any programming language like Python, C#, Java, etc for the creation of selenium test scripts. In this tutorial we will be discussion the creation of selenium test script using Python.

For further information about Selenium, refer the below link: /selenium-tutorial

Why we use Selenium for automation testing?

As we discussed above it is one of the most popular automated tool for testing purpose. The process of automation testing is it is used to convert any manual test case into the test scripts by taking the help of automation tools i.e., selenium.

Following are some aspects that, why we prefer Selenium for automation testing:

  • We can use any programming language like Java, Python, Ruby, Perl, C#, and so on to create the Selenium test scripts.
  • We can execute the selenium test script in many different operating system platforms that are Windows, Mac, Linux, etc.
  • Browsers like Google Chrome, Mozilla Firefox, Internet Explorer, Safari, etc are used to implement the selenium test scripts.
  • The Selenium testing tool can be associated with other testing tools such as TestNG, Junit for managing the test cases, and generating test reports.
  • To achieve continuous testing, Selenium is integrated with Maven, Jenkins, and Docker testing tools.

What is Python?

Python is a programming language which is used for soft coding. Using python we can develop any games, application in an easier manner when compared with the other programming languages. Because, Python provides inbuilt packages that can be used directly without any efforts of writing the separate code for them. So, most of the programmers choose Python for designing any application, games, etc.

Main advantage of the Python is it supports the Object-Oriented Programming approach to establish the applications very easily. Python is an open-source language i.e., we can learn and implement the program at free of cost by simply downloading the IDLE of the Python. It is simple and easy to learn and provides lots of high-level data structures.

Python is a high-level language and also it is termed as interpreter scripting programming language. The main advantage of using the Python language for development is it makes the development very fast by debugging the given codes fastly because in Python there is no compilation step will be present like other languages.

For further details about Python language, refer the below link: /Python-tutorial

Why is Python useful for automation testing?

  • Python supports multiple programming patterns to be performed at the same time and this will be very useful for automation testing. So, this is one possibility that Python is useful for automatic testing.
  • As discussed above Python provides many inbuilt libraries and frameworks that are very useful in testing like Pytest and Robot are the library used for testing the applications and also covers the debugging part and faster the workflow.
  • We use the Python for automatic testing because it is a interpreted language means during the compilation itself interpret every step line by line and by this the debugging process will be easier.
  • Python is Cross-platform Language; due to this application we can run the code written in Python on different platforms such as Windows, Linux, UNIX, Macintosh and so on.
  • Python can be easily implemented with other programming languages such as C, C++, JAVA, etc.

Selenium with Python

We can implement the Selenium test scripts using Python in following two ways:

  1. Configure Selenium using Python
  2. Configure PyDev in Eclipse.

Let us see how we configure Selenium with the help of Python programming language:

Configure Selenium using Python

If we want to configure the Selenium using python then we must follow some set of rules or steps given below:

  • Download and install Python on Windows
  • Install Selenium libraries in Python
  • Download and install PyCharm
  • Create a new project and write the Selenium test script
  • Run and validate the test scripts.

Download and install Python for Windows

Here, we will get to know how we can download and install the latest version of Python for window platform through internet.

Download the Python

To download the latest version of Python for Windows Platforms, refer the below link: https://www.Python.org/downloads/

Using the link provided above we can directly go to the page where we can find the various versions of Python. From that we have to choose the latest version, as we can see in the below image the latest version is Python 3.8.1 version, when we click on that we will be directed to other page:

Selenium with Python Tutorial

A separate window will be appeared on screen for the Python-3.8.1 version, after that we have to scroll the page little-bit down and search for the file section, finding that we will get some options for downloading it based on the compiler like Windows x36-64 web-based installer, x86-64 web-based installer. So, we have to choose the version that is good for our system as shown in the below image:

Selenium with Python Tutorial

Install the Python

After downloading the Python for Windows-64 bit, we will be ready to install the Python.

To install the Python, follow the below process:

After successfully downloading the latest version of the Python we will see a executable file, we have to double click on that file then a window will be appear on the screen for Python 3.8.1(64 bit) setup, then the window will display two options for installing the Python that are:

  • Install Now
  • Customize installation

Firstly, we will click on the customize installation button and then we will select Add Python 3.8 to the path checkbox as shown in the below image:

Selenium with Python Tutorial

After, click on the customize installation, there we will find some optional Features on the screen here, we can select the features that are required and the rest can be deselected according to our requirements.

After selecting all the appropriate features then, we have to click on the Next button, to proceed further as we can see in the below image:

Selenium with Python Tutorial

Once, we clicked on the Next button; then we will find some list of advanced features options here, same as the above we have to select the required and rest deselect them. And important thing is that we have check that install for all users is selected or not, if not we have to select it.

Not only installing the required features we can also customize the install location according to our requirements by clicking on the Browse

Selenium with Python Tutorial

After done with the all features then simply click on the install button then the installation of the Python will begin as shown in the below image.

Selenium with Python Tutorial

After done with the installation successfully, the system will show give the confirmation message like setup was successful, after getting this message we can conclude that the Python was successfully installed into the Windows operating system.

Then, click on the Close button, to close the setup window as we can observe in the below screenshot:

Selenium with Python Tutorial

Then we will check that the Python is installed successfully or not, and we will also check weather, it is working properly or not. For checking this we have to open systems command prompt, then we have to give the command as "Python" and press the enter button, if the Python interpreter is present in our system, then this command will directly open the interpreter where we can implement and run the Python programs as shown in the below image:

Selenium with Python Tutorial

Installing the Selenium libraries in Python

Once we successfully install the Python in our operation system, we will install the Selenium libraries.

To install the selenium library in our system we can install it directly in to the operating system using the command prompt. We have to use pip for installing the libraries into the system. By using the below command, we can install the selenium library:

The above command will check for the latest version available in the internet and then command prompt will download and install the library. We can see in the image below that the latest version of selenium is selenium-3.141.0. S, this will be installed into the system.

Selenium with Python Tutorial

After that executing the above command, directly one separate folder will be created for selenium which contains all the Selenium libraries as we can see in the below screenshot:

Selenium with Python Tutorial

Download and install PyCharm

We have to download and install the PyCharm once the selenium libraries is installed successfully into the Python. To install PyCharm we have to download and install the Python IDLE into the system.

To download the PyCharm, follow the below process:

Refer the below link, to download the PyCharm https://www.jetbrains.com/pycharm/download/#section=windows

Using the link provided above we can directly go to the page where we can find the various versions of Python PyCharm. From that we have to choose the latest version, as we can see in the below image the latest version is PyCharm is 2019.3.1 version, there we will find two options for downloading PyCharm i.e., Professional and community. At, first we have to select the option of operating system like Windows, Mac, Linux, etc. Then we have to select the community option for downloading the PyCharm.

Selenium with Python Tutorial

After successfully downloading the latest version of the PyCharm we will see a executable file, we have to double click on that file then a window will be appear on the screen for PyCharm community Edition setup, then we have to click the button next to proceed the installation of PyCharm as shown in the image below:

Selenium with Python Tutorial

After that we have to select the location of the file to install by clicking on the browser button then we have to click on the Next button to process the request of installation.

Selenium with Python Tutorial

In the next step, we will find some list of advanced features options here, same as the above we have to select the required and rest deselect them. And important thing is that we have to update the path variable and create the Desktop shortcut button and click on the next button based on our requirements.

After that, click on the Next button as we can see in the below image:

Selenium with Python Tutorial

Then, click on the Install button to install the PyCharm, as we can see in the below screenshot:

Selenium with Python Tutorial

As we can see in the below image, the installation process is getting started.

Selenium with Python Tutorial

Then, click on the Finish button to finish the installation process as we can see in the below image:

Selenium with Python Tutorial

Create a new project and write the Selenium test script

Once the PyCharm is installed successfully, then we have to open the PyCharm IDLE then we can see the below interface then we have to click on create new project by which we can create a new selenium script using it.

Create a New Project in PyCharm

Follow the below process, to create a new project in PyCharm:

  • First, open the PyCharm by Double-click on it, and click on the Create New Project as we can see in the below image:
Selenium with Python Tutorial

After clicking on the new project button, we will see the interface as shown in the below image, here we have to give the title or name of the project i.e., Selenium test. We have to declare the location of the file while creating the new project. Then we have to click on the create button.

Selenium with Python Tutorial

Once we are done with the giving the name and location of the file we will click the create button then we will get the window as shown below image:

Selenium with Python Tutorial

Adding Selenium Test Scripts

Let us discuss how to add the Selenium test scripts into the PyCharm using the process below:

Firstly, Right-click on the Selenium Test project created previously, there we can find some options from it click on the New, when we click on the New it will show some options like file, New Scratch file, Directory, and more as shown in the below image. From the list we can add the required options based on our requirements.

  • But, here we are adding the Python file, so for this, we will add the Directory which helps us to manage them separately as we can see in the below screenshot:
Selenium with Python Tutorial

we have to add the Directory name to get the access easily, in this case we will name our directory as Demo. After done with all the above process then press enter to continue as shown in the below image:

Selenium with Python Tutorial
  • After creating a Directory, we will right-click on the Demo Directory then go to New, and select Python File from the pop-up menu as we can see in the below image:
    Demo → New → Python File
Selenium with Python Tutorial

Here also we have to follow the same process as previous like we have to give a name to the Python file and we declare the Python file as sample1. After done with the naming of the file simply press enter to continue as shown in the below image:

Selenium with Python Tutorial
  • After that, we got the IDE where we can create or write our Selenium test Scripts.

Write the Selenium test script

For our testing purpose, we will first go to the Google Home page and search javatpoint from there.

Here we are providing the whole process of creating the sample selenium test script step by step for better understanding of how selenium test script is developed using the Python Programming language.

For this, follow the below steps:

Steps Actions Input Expected Result
1. Import WebDriver from selenium. The WebDriver should be imported.
2. Open the Google Chrome browser. The Google Chrome browser should be opened.
3. Maximize the browser window. The browser window should be maximized.
4. Navigate to the Google home page. https://www.google.com/ The Google home page must be displayed.
5. Identify the Google search text box and pass the value. javatpoint The value should be entered in the search text box.
6. Click on the Google search button. The Google search button should be clicked.
7. Close the Browser. The Browser should be closed.

Step1

When we write any programming language firstly, we are import all the required modules into the program. In the same way, we are importing the Web driver from the selenium package.

Selenium with Python Tutorial

Step2

After importing the web driver then we will open the Google chrome browser when we try to open the browser here, we will have multiple options as shown in the image like chrome, Edge, fire fox, Internet Explorer, opera, safari, etc. From the list of above browsers, we will open the Google Chrome browser.

Selenium with Python Tutorial

We can directly open the Google chrome browser by using the below sample code:

Step3

If we want to maximize the window size of the browser then use the below code:

Step4

Then, we will navigate to the given URL.

The sample code is as below:

Note: As we see in the above lines of codes we didn't write many lines of code, but we have used the pre-defined methods this is the main advantage of using the Python programming. Whereas in other language we have to write many lines of statements to perform the same task in Java, C, C++.

Step5

In this step, we are trying to locate the Google search text box with the help of its Name attribute value.

To do such thing we have to right-click on the Google search text box, then we have to select the Inspect option in the pop-up menu as we can see in the below image:

Selenium with Python Tutorial
  • The developer tool window will be launched with all the specific codes used in the development of the Google search text box.
  • And, copy the value of its Name attribute, that is "q" as we can see in the below image:
Selenium with Python Tutorial

Here the sample code:

Step6

Once we identify the Google search text box, and we will identify the Google Search button.

So for this, follow the below process:

To do such thing we have to right-click on the Google search button, then we have to select the Inspect option from the given pop-up menu as we can see in the below image:

Selenium with Python Tutorial

The developer tool window will be launched with having all the specific codes used in the development of the Google search button.

After that we have to copy the name attribute value i.e., "btnk". It should be done in the way as shown in the image below:

Selenium with Python Tutorial

And, the sample code is as following:

Step7

In the last step, we have to closing the browser. To close the browser we have to write the sample code which closes the browser, we can use the close() method directly in Python to close the browser.

Our final test script will look like this, after completing all the above steps:

Note: In the program we imported the time module as Import time. Time is a Python module, which is used to handle the time-related tasks such as time.sleep().

from Selenium.webdriver.common.keys import Keys:

The above code of the line represents adding keys libraries from the package selenium.webdriver, like in this scenario we are not using the click() method instead we are using the Enter key to perform some specific tasks.

Run and validate the test scripts

After the completion of writing the selenium test scripts, we have to run the test scripts.

Here we will run our test scripts in two ways:

  • Run in Python IDE
  • Run in Command Prompt

Run in Python IDE

The first way to run our selenium test scripts is by using the Python IDE.

When we are in the Python file where our code is present then right-click on the code, there we will find a popup will be shown in which various options will be present, from that search for the option run 'sample1' and select it as shown in the below image:

Selenium with Python Tutorial

After clicking on the option our test script will start compiling the code line by line and checks for any errors or exceptions are present in the code or not. If any error or exception is present then it will raise the exceptions to the output screen. In the test script after the compilation is done, it will raise the exception 'chrome driver needs to be in path' because we don't have the Chrome driver executable file as we can in the below image:

Selenium with Python Tutorial

To solve the error raised in the code we have to download the chrome driver executable files using the link below: https://chromedriver.storage.googleapis.com/index.html?path=79.0.3945.36/

Once we click on the above link, we will find some zip files with various operating system like Windows, MAC, Linux, etc. we have to choose the zip file based on the operating system used in the system. If we are using the Windows operating system the select the file that is marked in the below image and directly download the chrome driver executable file.

Selenium with Python Tutorial

We have to download and then the downloaded exe file should be pasted to the Python folder file and then we have to unzip the folder.

Then, we will create one more folder called libraries as Browsers in the Python IDE.

Right-click on the Project(SeleniumTest) → New → Directory as we can see in the below screenshot:

Selenium with Python Tutorial

After the directory is successfully created, we will add all the driver's executable files in the Browsers folder manually.

To do this we have to copy the chrome driver exe file that was downloaded previously from the Python folder. Then we have to paste the copied file to the Browser folder which is shown in the below image:

Selenium with Python Tutorial

Then open the PyCharm IDE and we have to copy the Absolute path of cjromedriver.exe file from it as shown below:

Selenium with Python Tutorial

we have to change or replace the statement that is previously declared i.e., "driver = webdriver.Chrome()" with a statement given below which contains the path of the chrome driver exe file:

Note: In the above statement you must have a doubt that why we have used the "r", because it is used to overcome the Unicode errors.

Take a scenario like remove the r in the chrome driver exe file path and run the code then it will raise an syntax error shown in the below image:

Selenium with Python Tutorial

Now, we have rectified the error occurred i.e., "chrome driver exe file not found". Now we have to run our sample1 code again to check is there any error in the code or it will execute successfully, and the code runs successfully without errors as shown in the below image:

Selenium with Python Tutorial

The above test script will launch the Google Chrome browser and automate all the test scenarios.

Selenium with Python Tutorial

Run in Command Prompt

This is the second way that can be used to run the selenium test script in the Command prompt, to run the test script we have to follow the below process:

Firstly, we have to copy the location of our selenium test script file i.e., Sample1.py as shown in the below image:

Selenium with Python Tutorial

After successfully copied the location open the command prompt and paste the path directly in the command prompt, we have to go to the folder in which it is present i.e., Demo after opening the folder we have to give the command given below:

Python Sample1.py

Then press the Enter button to start the process. Here we can say that the program is running by seeing the message in the command prompt as "sample test case started".

Here, the command prompt will automatically runs all the scenarios, and after done with the compilation it will show the message as "sample test case successfully completed".

Selenium with Python Tutorial

Configure PyDev in Eclipse

This is another way to execute the Selenium test script using Python.

We can also execute our selenium test scripts with the help of PyDev in Eclipse. Firstly, we have to download and install the Eclipse then execute the selenium test script.

We can install the PyDev in Eclipse using the below process:

  • Install PyDev
  • Execute the Selenium test scripts using Python.

Install PyDev

To install the PyDev in Eclipse, follow the below process:

  • PyDev installation
  • Set the preference
  • Create a new project
  • Create a new package
  • Create a PyDev Module

PyDev Installation

The PyDev is only an extension that is available in the Eclipse IDE, if we want to install the PyDev then we have to make sure that we have the latest version of the Eclipse IDE.

  • Double-click on the Eclipse IDE software.

Then, the eclipse will be opened and there we will see some options like search, project, run, window, help. From the options select the help and then press "Eclipse Marketplace" from the given pop-up menu as shown in the figure:

Selenium with Python Tutorial
  • Eclipse Marketplace window will open, and in the search area, we will type PyDev and press the Enter

Here, we will find the PyDev latest version then, press on the install button and the installing will start as shown in the figure:

Selenium with Python Tutorial

Once the installation is in progress we will find some features there select the required features from it and click on the confirm button to process and complete the installation as shown in the below image:

Selenium with Python Tutorial
  • Then, select I accept the terms of the license agreements option and click on the Finish button to finish the installation process as we can observe in the below image:
Selenium with Python Tutorial

After done with the installation we have to restart the Eclipse IDE, we will see an interface as shown in the below image to restart the IDE:

Selenium with Python Tutorial
  • After that, we will set the preference to use the Python project based on our requirements.

Set the Preference

To set the preference, follow the below process:

In the Eclipse IDE toolbar, we will find the option of Windows and here many options will be present from that select the preference option from the list of options as we can see in the below image:

Selenium with Python Tutorial

The Preference Window will open where we will expand the PyDev then again expand the Interpreters here we will find some options like IronPython, Jython interpreter, Python interpreter. From that select the Python interpreter. Click on the Browse for Python/pypy.exe option as we can observe in the below image:

  • PyDev → Interpreters → Python Interpreter
Selenium with Python Tutorial

Here we will see an option on the top right corner like "Browse for Python/pypy.exe". Once we click on that button a new interface will appear on the screen in that we have to provide the Interpreter Name and the interpreter executable file path of Python.

After successfully provided the name and the executable path we have to click on the browse button and it will browse the executable file path from the local system and then click on the ok button as shown in the below image:

Selenium with Python Tutorial

Then we have to select all the folder present in the executable file folder, simply click on select all button present to select all folder at a time and then click on ok button present at the bottom as shown in the image below:

Selenium with Python Tutorial

Once we are done with all the setting part then we have to click on the button Apply and Close to complete the setting up of the preference process.

Selenium with Python Tutorial
  • After setting the preference successfully, we will create a new project in Python.

Create a new project

To create a new project, follow the below steps:

  • Go to the File menu then go to New and select Other option in the popup menu as we can see in the below image:
    File → New → Other
Selenium with Python Tutorial

When we select the other option from the pop-up window then a new window will open there we will find some folder from that we have to select and expand the PyDev and from that select the PyDev project, and done with all click on next button as shown in the image:

Selenium with Python Tutorial
  • Once we clicked on the Next button; we will provide the Project name and click on the Finish button as we can observe in the below image:
Selenium with Python Tutorial

After giving the name of the project in the Python then the project is created successfully in the Eclipse as we can see in the below image:

Selenium with Python Tutorial
  • When we are done with creating a Python project, we will create a new Python Package.

Create a New package

Follow the below process, to create a new package:

To create the new package firstly, right-click on the project created previously as selenium test and then click on new and some options will be displayed from that select the PyDev package as shown in the image:

Selenium with Python Tutorial
  • Then provide the name of the PyDev Package, and click on the Finish Button as we can see in the below image:
Selenium with Python Tutorial
  • As we can see in the below screenshot that the new package is created.
Selenium with Python Tutorial

After creating a PyDev Package, we will create a PyDev module.

Create a PyDev Module

To create a PyDev module, follow the below process:

To create the new PyDev module firstly, right-click on the package created previously as Demo and then click on new and some options will be displayed from that select the PyDev module as shown in the image:

  • Demo → New → PyDev Module
Selenium with Python Tutorial

After selecting the PyDev module we have to name that as "Test" as shown in the below image and once we are done with giving the name for it then we have to click on the finish button to complete the process and then our module will be created successfully.

Selenium with Python Tutorial
  • After that, we will select the Empty template from the given list, and click on the OK button as we can see in the below image:
Selenium with Python Tutorial

After successfully creating the python model that can be used to write and execute the Selenium test scripts. Now we can write and execute them using the model created.

Write and Execute the Selenium test script

Write the Selenium test Script

To test our selenium test scripts firstly, we have to perform a login test in the Gmail application.

In this test, we will automate the below test scenarios:

Steps Actions Input Expected Result
1. Import web driver from Selenium. Web driver should be imported.
2. Open the Google Chrome browser. The Google Chrome browser should be opened.
3. Maximize the browser and delete all the cookies The browser should be maximized, and cookies should be deleted.
4. Navigate to the home page Gmail application. https://www.gmail.com The Gmail home page must be displayed.
5. Identify the username text box and pass the value. [email protected] The username text box should be identified and value should be entered in the username text box.
6. Click on the Next button. The next button should be clicked.
7. Identify the password text box and pass the value. ####### The password text box should be identified and value should be entered in the Password text box.
8. Click on the Next button. The next button should be clicked.
9. Close the Browser. The Browser should be closed.

Follow the below steps:

Step1

Here, we are starting the process to write the selenium test scripts to do that the first step includes importing the required packages like in this we have to import the web deriver using the below statement:

Step2

After that, we will open the Google Chrome browser.

  • To launch the Google Chrome or any other browser (Firefox, ie, etc.), we need to download the executable files of the Chrome driver from the given link: https://sites.google.com/a/chromium.org/chromedriver/downloads
  • Then, paste the downloading exe file in the Python package (demo) to overcome the exceptions as we can see in the below screenshot:
Selenium with Python Tutorial

The sample code is as below:

Step3

This step is mainly used to maximize the window and then we have to delete all the cookies of the selected browser.

Here the sample code:

Step4

The fourth step is responsible for navigating the user from the Python to the Gmail application using the URL of the application:

The sample code is as below:

Step5

Once we navigate to the URL of the Gmail application, there we will be having the username or Email text box. In that we have to pass our value.

If we want to identify the username text box then follow the below process:

Right-click on the username text box. Here, we will see many options from that select the inspect button available at the bottom as shown in the image below:

Selenium with Python Tutorial
  • The developer tool window will open with all the specific codes used in the development of the usernametext box.
  • Then, copy the value of its id attribute that is: identifierId as we can see in the below image:
Selenium with Python Tutorial
  • And, here the sample code:

Step6

In this step, we will identify the Next button and click on it.

To identify the Next button, follow the below process:

  • Right-click on the next button, and click on the Inspect option in the given pop-up menu as we can see in the below image:
Selenium with Python Tutorial

Here again the options will be shown that are used in the development of the Next button.

  • And, copy the value of its absolute XPath that is: //span[@class='RveJvd snByac'] from the chropath section as we can see in the below image:
Selenium with Python Tutorial
  • Here the sample code:

Step7

In this step, we will identify the password text box and pass the value of it.

To identify the password textbox, follow the below process:

  • Right-click on the password text box, and click on the Inspect Option from the given pop-up menu as we can see in the below screenshot:
Selenium with Python Tutorial

Here again the options will be shown that are used in the development of the password text box.

  • And, copy the value of name attribute, i.e., password as we can see in the below image:
Selenium with Python Tutorial

Here the sample code:

Step8

In this step, we will identify the Next button and click on it.

To identify the Next button, follow the below process:

  • Right-click on the next button, and click on the Inspect option in the given pop-up menu as we can see in the below image:
Selenium with Python Tutorial
  • Here again the options will be shown that are used in the development of the Next button.
    • Copy the value of its absolute XPath that is: //span[contains(text(),'Next')] from the chropath section as we can see in the below image:
    Selenium with Python Tutorial

    Here the sample code:

    Step9

    In the last step of the test script, we will close the browser.

    Here the sample code:

    And, our final test script will look like this after writing all the above steps successfully.

    Note: In the above code, use your Gmail id at place: [email protected] and password: #########

    Run the test script

    To run the above test script, we have to right-click on the code and then we will see some options from that select Run As → Python Run as we see in the below screenshot:

    Selenium with Python Tutorial

    To run the above test script, we have to right-click on the code and then we will see some options from that select Run As ? Python Run as we see in the below screenshot:

    Selenium with Python Tutorial

    And, as we can see in the below screenshot that our code is running successfully as we get the print message (output) on the console screen.

    Selenium with Python Tutorial



    Youtube For Videos Join Our Youtube Channel: Join Now

    Feedback


    Help Others, Please Share

    facebook twitter pinterest

    Learn Latest Tutorials


    Preparation


    Trending Technologies


    B.Tech / MCA




    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news
    news