- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Modern Web Automation With Python and Selenium
We can have modern web automation with Python and Selenium. To configure with Selenium webdriver in Python the steps described below need to be followed −
Step1 −To install Python in our system, visit the link − https://www.python.org/downloads/
Step 2 − Click on the Download Python <version number> button. Once the download is completed, the Python executable file should be available in our system.
Step 3 − Double-click on this executable file and the Python installation landing page should be opened. Click on Install Now.
Step 4 − Python should be available in the below path −
C:\Users\<User>\AppData\Local\Programs\Python\Python<version>
Step 5 − We shall configure the path of the folders - Python and Scripts (introduced within the Python folder) in the Environment variables for the Windows users.
Step 6 − To verify, Python has been installed, run the command: python --version. The Python version should get displayed.
Step 7 − Selenium bindings installation can be done by executing the command: pip install selenium.
Step 8 − A folder called Selenium should be found within the Python folder. To update the Selenium existing version, run the command: pip install –U selenium.
Step 9 − Finally, we should also have a Python editor - PyCharm to create the Selenium scripts((https://www.jetbrains.com/pycharm/).
Step 10 − To launch the Selenium script in a browser, we also need to download the browser drivers. For this, visit the below link − https://www.selenium.dev/downloads/
Step 11 − Scroll down to the Browser section and to download the browser drivers for different browsers.
Example
Code Implementation
from selenium import webdriver #configure chromedriver path driver = webdriver.Chrome(executable_path='../drivers/chromedriver') #implicit wait driver.implicitly_wait(0.5) #url launch driver.get("https://www.tutorialspoint.com/questions/index.php") print('Page title: ' + driver.title) #browser close driver.close()
Output
- Related Articles
- Get Started With Selenium and Python Automation
- Selenium Web Test Automation Framework Best Practices.
- Why use Selenium WebDriver for Web Automation?
- Google Search Automation with Python Selenium
- How to use Selenium WebDriver for Web Automation?
- Save a Web Page with Python Selenium
- How to get text with selenium web driver in python?
- What is the difference between selenium and automation?
- Get text using selenium web driver in python?
- Create web element driver method in selenium Python
- How does selenium interact with the Web browser?
- Difference between selenium RC and Web Driver?
- What is selenium web driver?
- Mouse and keyboard automation using Python?
- What is Web Driver in Selenium?
