Selenium’s Python Module is built to perform automated testing with Python. Selenium Python bindings provides a simple API to write functional/acceptance tests using Selenium WebDriver. Through Selenium Python API you can access all functionalities of Selenium WebDriver in an intuitive way. To check more details about Selenium visit – Selenium Basics – Components, Features, Uses and Limitations.
Selenium Python Introduction
Selenium Python bindings provide a convenient API to access Selenium WebDrivers like Firefox, Ie, Chrome, Remote etc. The current supported Python versions are 2.7, 3.5 and above.
- Open Source and Portable – Selenium is an open source and portable Web testing Framework.
- Combination of tool and DSL – Selenium is combination of tools and DSL (Domain Specific Language) in order to carry out various types of tests.
- Easier to understand and implement – Selenium commands are categorized in terms of different classes which make it easier to understand and implement.
- Reduce test execution time – Selenium supports parallel test execution that reduce the time taken in executing parallel tests.
- Lesser resources required – Selenium requires lesser resources when compared to its competitors like UFT, RFT, etc.
- Supports Multiple Operating Systems – Android, iOS, Windows, Linux, Mac, Solaris.
- Supports Multiple Browsers – Google Chrome, Mozilla Firefox, Internet Explorer, Edge, Opera, Safari, etc.
- Parallel Test Execution – It also supports parallel test execution which reduces time and increases the efficiency of tests.
Selenium Python Installation
For any operating system selenium can be installed after you have installed python on your operating system .If not, checkout – Download and Install Python 3 Latest Version
Open Terminal/Cmd and Write Command as written Below
python -m pip install selenium
Alternatively, you can download the source distribution here, unarchive it, and run the command below:
python setup.py install
One Can Install Firefox, Chromium, PhantomJs(Deprecated Now), etc.
- for using Firefox you may need to install GeckoDriver
- for using Chrome you may need to install Chromium
In this article, Firefox is used so One can Follow the Bellow Steps to Install:-
Steps for Linux:-
1. Go to the geckodriver releases page. Find the latest version of the driver for your platform and download it.
2. Extract the file with:
tar -xvzf geckodriver*
3. Make it executable:
chmod +x geckodriver
4. Move Files to usr/local/bin
sudo mv geckodriver /usr/local/bin/
Steps for Windows:-
1. Same as Step 1 in Linux Download the GeckoDriver
2. Extract it using WinRar or any application you may have.
3. Add it to Path using Command Prompt
setx path "%path%;GeckoDriver Path"
setx path "%path%;c:/user/eliote/Desktop/geckodriver-v0.26.0-win64/geckodriver.exe"
Creating Simple Code
- Introduction and Installation of Uberi/Speechrecognition in Python
- Wand Python - Introduction and Installation
- pgmagick Python- Introduction and Installation
- Django Introduction and Installation
- Jython - Introduction and Installation
- Beautifulsoup Installation - Python
- Django REST Framework Installation
- Tableau Installation Guide
- Flight-price checker using Python and Selenium
- How to use close() and quit() method in Selenium Python ?
- How to move back and forward in History using Selenium Python ?
- Adding and Deleting Cookies in Selenium Python
- Scraping COVID-19 statistics using Python and Selenium
- Cloud-based Automation using Selenium in Python and BrowserStack
- Selenium Python Tricks
- Selenium Base Mini Project Using Python
- Python | SMS Bomber using Selenium
- Non blocking wait in selenium using Python
- Python | Automating Happy Birthday post on Facebook using Selenium
- How to access popup login window in selenium using Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.