PYTHON
Getting Started with Selenium using Python
Selenium is a web framework used by developers to test web applications. Various processes such as web scraping, access cookies, UI/UX test automation use this open-source testing tool. Selenium supports all the major programming languages such as Python, Java, Ruby, C#, JavaScript, and more. Selenium with python is one of the most commonly discussed topics. So, let us dive into the details.
Prerequisites
Assuming that you have already installed python on your system, below are the requirements.
Steps
1. Open a python file and name it as selenium_basics.py and add the following code.
a. First, we need to import the webdriver from selenium using from selenium import webdriver.
b. Next, define the location/path of the driver that you have downloaded (Chrome Driver, usually named chromedriver.exe).
c. Now, we will define the driver using the driver = webdriver.Chrome(). We will provide the path/location of the chrome driver as the argument for this.
d. We have everything setup. Now, all you need to add is driver.get("https://www.google.com/"). You can add whichever URL/website address you wish to open. Here, I have added "https://www.google.com/" as the URL.
e. Save and run the above python program from the command line using python selenium_basics.py. You will now see a browser window opening with the homepage of Google.
Performing the above steps is pretty simple. But, some things to keep in mind.
1. Web drivers such as chrome drivers keep updating. So, you need to make sure you have the latest version installed, or it may not work as expected.
2. Make sure the location of the chrome driver file is correct.
The above steps are the simple steps for getting started with selenium. There are a ton of operations that you can do with selenium like clicking buttons, getting page contents, accessing cookies, download files, scrolling pages, etc. We will learn more about these operations in the upcoming blogs.
Read Next
PYTHON
How to take a screenshot in selenium using python?
A guide on how to take a screenshot in selenium using python?
FLUTTER
Clipping using clippy_flutter package in Flutter
A guide on how to clip images circular, oval, rectangular and in custom shapes using custom clipper in Flutter
FLUTTER
Custom Clipper in Flutter
A guide on how to create a custom clipper in Flutter