Web testing plays a crucial role in ensuring the quality and functionality of modern web applications. However, the process of creating and executing web tests can be complex and time-consuming. Fortunately, Selenium IDE comes to the rescue as a powerful yet user-friendly tool for automating web tests. In this blog post, we will explore Selenium IDE, its features, and how it simplifies web testing via scriptless automation.
What is Selenium IDE?
Selenium IDE is an Integrated Development Environment that allows users to record, edit, and execute web tests in a browser. It is a browser extension available for Chrome and Firefox that provides a graphical user interface (GUI) for creating and managing automated test scripts.
One of the key features of selenium IDE which we are going to talk about here is :-
Recording and Playback: It captures actions such as clicks, form submissions, and text input, generating test scripts in real-time. These recorded scripts can then be played back to replicate the same actions and validate the expected behavior.
Now let me walk you through the procedure of creating a simple test case of login functionality of a web application called “actiTIME”.
Step 1: Getting the Selenium IDE extension for google chrome:
Go to www.google.com and type “selenium IDE extension for chrome” in the search bar. And hit enter. You will be led to the Google search results page. Choose the first option and click on “add to Chrome” or you can directly go to this URL to get the extension for Chrome:- https://chrome.google.com/webstore/detail/selenium-ide/mooikfkahbdckldjjndioackbalphokd
Step 2: Automating web App using Selenium IDE extension.
That’s right. No more hassle of getting dependencies and maintaining them. You can straight up just start creating projects, write test cases and run them on the go. No complicated procedures of using build automation tools or testing frameworks such as Maven or TestNG respectively.
a) Click on the Selenium extension icon in the top right corner of the screen.
b) Click on “Create a new project”.
c) Choose a project name of your choice and click OK. Here I am giving “actiTime” as my project name.
d) You will be seeing the project window on your screen now. Click on the record button in the Selenium IDE window’s top right corner.
e) You will be prompted to enter the base URL of your application which is basically like the entry point to your web App. Enter the URL of your application and click on the “START RECORDING” button. Here I am entering:- https://demo.actitime.com/login.do
f) New window of your Web App will open. From this point onwards every action performed on the newly opened window will get recorded and Selenium IDE will automatically generate test scripts which can be executed at the time of automated testing later on simply with the help of a play button.
g) Enter Username and Password as trainee and trainee. Click the Login button. You will be successfully able to view the homepage of the actiTIME application.
As you can see, selenium IDE has been recording all your interactions with the webpage and generating test scripts.
Now you can do a little verification which is a sort of soft assertion in Selenium IDE. Obviously, the logout button should be visible only if you are able to enter the homepage post successful login action. So you can validate whether the logout button exists on the homepage or not. If it exists then it would mean that you had landed on the homepage.
To do that follow these easy steps:-
The ninth step was clicking the login button. Click on the empty row below the ninth row.
Click the dropdown arrow in the command text field.
Fill the text boxes below with the following data:
Command: verify the text
Target: (No need to manually type locator. Because this is scriptless automation and you don’t need programming knowledge at all.) Click on the “Select Target on page” button present next to the Target dropdown. Go to the webpage and click once on the target element. Its locator will be fetched automatically by Selenium IDE.
Value: Type the expected text.
Description: Type a description that fits best.
Now we can perform the actual logout action. But you need to click on the empty eleventh row before performing any action which needs to be recorded or else the tenth row will get edited and the tenth row is for verifying the expected text. We don’t want to edit that.
So click on the empty row below the tenth row and perform the logout action by clicking the logout button.
Now that all the steps have been written you can click on the play button and watch the entire test case run on your screen.
I would like to conclude by saying that even though Selenium IDE enables anyone to perform automation testing it still has one drawback. It can’t perform tests where you may have to interact with one particular element from a bunch of elements based on certain conditions. For example, if you have to choose a date in real time where the condition is such that you have to choose today’s date if the time is before 5 PM but choose the next date if the time is after 5 PM then you are gonna have to need coding knowledge. Because otherwise, scriptless automation won’t be able to make that decision in real-time on your behalf.
Other than that selenium IDE is a fantastic scriptless automation tool with the help of which just about any and everyone can perform automation testing. Even those who don’t have much knowledge of coding skills.