☰ See All Chapters |
How to create test cases manually from Selenium IDE
In this tutorial you will learn to create test cases manually from selenium IDE instead of using recording option. We will create steps by inserting selenium commands. We will cover the following below actions in the test case.
Open firefox and type www.google.com
Type “java4coding” in the Google Search Input Box
Click Search Button
Step 1: Launch Firefox and create project
Open Firefox, go to tools, and click on selenium IDE.
Select Create a new project
Enter Project Name and click Ok
Step 2: Create test script to open www.google.com
In Test Script Editor Panel enter the following values.
Command : open
Target : https://www.google.co.in
Step 3: Create test script to focus/enter on search box
Now we have to create the command to click on search input text box. Now we have to identify the property which is unique to this input search box. This property should be unique from all the html code which has been rendered. Using this unique property we can create the command to locate the input search field. While identifying the unique property we can consider any attribute of the html tag, or we can frame combination of attributes of the html tag, but final it should be unique from the all html code in the current page.
Most of the time developers attach the id attribute and which will be unique to the page. If id attribute is not present we can consider name, class or any other attributes or combination of attributes to get the unique identification.
To identify the unique identification property we can use browser developer tool to inspect the element. Open https://www.google.com browser. Right click on the Google search text box and select Inspect Element.
It will launch a window containing source code of the page and in the code the html tag which is rendering the input search field will be highlighted. Find the attribute name and get the value of it.
In Test Script Editor Panel enter the following values create the command to click on search input text box.
Command : open
Target : name=q
Step 4: Create test script to enter search text
Create the command to type java4coding in the search input filed. In Test Script Editor Panel enter the following values create the command to click on search input text box.
Command : type
Target : name=q
Value: java4coding
Step 5: Create test script to click on “Google Search” button
Create the command to click on the “Google Search” button. By using developer’s tool inspect this “Google Search” button and get the unique property of this button. We found name="btnK" is unique to this button.
In Test Script Editor Panel enter the following values create the command to click on search input text box.
Command : click
Target : name=btnK
Step 6: Name the test case
Now we have created all the commands. Name the test case; we named it to “Testcase”. Click on menu, select Rename and name it.
Step 6: Execute the commands
To execute the command enter the Playback Base URL and click on Run button
Check the log panel to see the result.
Note:
Suppose if you wish to update any command select the command and edit from editor panel.
If you have to add a command in between the commands, right click on the command above which you wish to add command and select “Insert new command”
Login Test Case
We have created a test site https://www.registration.tools4testing.com/ to try login action.
Please register to this test application https://www.registration.tools4testing.com/, try to create the commands and execute them. Please keep the registration and credential ready, we use this registration application going forward as a test application.
All Chapters