Selenium is the recent craze among the software testers. Every tester is including both automation and manual testers are in a race to learn this tool to stay in the competition. One of the biggest features of Selenium is its IDE. Wish to know what’s so special about Selenium IDE?
Selenium integrated development environment that is plugged into Firefox. It is an automation testing tool that is very simple, easy and user-friendly. It offers easy installation, learning, and creation of test scripts. Selenium IDE is based on record and playback principle. It is good for all kinds of testing.
Selenium is widely used automation testing tool and offers extensive features. Some of the common features of Selenium IDE are:
- It offers easy and simple record and playback features
- Supports Intelligent field selection
- Auto completion of Selenium commands
- Walk through tests
- Easy Debugging capabilities
- Easy setting of breakpoints
- Save tests as HTML, Ruby, Python, C# scripts, or any other format
- Supports Selenium user-extensions.js
- Supports automatic assertion of title for all pages
- Supports easy customization
- Does not require programming skills
The drawback of Selenium IDE
Selenium IDE is a Firefox plug-in hence it supports only Firefox and the test scripts Created in Selenium IDE can only be executed in Firefox browser. Now when we have a good idea on what is Selenium IDE, let us move to the next step of Downloading and Installing Selenium IDE. To download Selenium IDE you need to have Mozilla Firefox, if you have it well and good if you don’t have it, download it.
1) Launch Mozilla Firefox Browser.
2) Open Selenium IDE Add-ons page by typing URL: https://addons.mozilla.org/en-us/firefox/addon/selenium-ide/ in your browser. Next Click on Add to Firefox button.
3) You will get a popup asking for your permission to install Selenium IDE Add-ons or not. Click the Install button over the popup.
4) Firefox will then install Selenium IDE software and you will get a popup asking you to restart the Firefox. Click the restart button. The Selenium installation will now be reflected on your browser.
5) After you restart you ur browser you can find the selenium IDE under the tools menu list present at the top bar
6) Click on selenium ide your selenium ide will launch
Sections of SeleniumIDE
Selenium IDE is divided into different sections. Before start working on it, you must know about these categories:
present at the uppermost of the Selenium IDE window. The menu bar consists of five sub-modules.
File Menu: File Menu Create, Save and Export Test Case and Test Suite of Selenium IDE. You can open the file menu by pressing Alt + F, or by clicking on the File menu.
Under File menu you can find:
Edit Menu: Edit Menu helps to Cut Copy Paste and Insert Command in Selenium IDE Test. You can open the Edit menu by pressing Alt + E, or by clicking on the Edit menu.
Under Edit Menu you can find:
Actions Menu: Helps us to learn Options to Record Play Run And Debug Selenium IDE Test.
Other categories available at Menu Bar are:
Options Menu and Help Menu
The ToolBar includes the Buttons that Control the execution of test cases, for debugging the test cases, setting up the speed of the test, Stopping, Playing and Recording of test cases.
All the test cases recorded by IDE are available in Test Case Pane. It can open more than one test case at the same time and supports easy shuffling between the test cases.
It also offers Test Execution Result Summary including entire Test Suite status, Total number of Test Executed, etc.
It is the place whereTest Case Steps are recorded. All the user actions are recorded in the order they are performed. It also allows the editing and changing of the test cases
The bottom pane or the offers the following functions
The function performed depend upon which tab is selected.
- Launch Firefox Selenium IDE. Type the URL. Click the Record button, a red button on the top right corner. It will record Test Cases.
- In Firefox, type the same URL as in step 1. Firefox will take you the related webpage.
- Right click anywhere on this page, you will get Selenium IDE context menu. In the context menu go to Show Available Commands> Web Page Name.
- Click on MyAccount
- Enter UserName and Password and then click on log in button.
- To stop the recording click the record button again. Click on the Table tab and you will be able to see the recorded commands.
- Click on the Source tab to see HTML Code.
Read also : 11 Awesome Selenium Alternatives For Testers in 2019
File -> Save Test Case As.
- Choose the desired location and give your file a name and click on Save.
- You can see the name of the saved test case on the left-hand side.
- The file will be saved as HTML.
PlayBack Selenium IDE Test Script
Open a new tab Firefox. Click the Play button in Selenium IDE. It will execute the previously recorded tests.
Selenium commands or Selenese are a set of test cases that are deployed to test web applications using Selenium.
Selenium commands are of three types:
Actions commands control the state of the application. Operations under action commands are:
Some of these commands can be suffixed with AndWait like clickAndWait, typeAndWait. This prompts Selenium to wait until the web page is loaded. If these commands fail, the existing test is stopped.
These commands automatically create Assertions and inspect the state of the application.
They inspect the state of the application adapts to what is anticipated.
They can be further divided into three categories:
Some of the Commonly used commands in Selenium IDE: What are Locators?
Locators in Selenium IDE are used to find and match the elements in the webpage that are required to communicate with. The use of right locator promises faster, more trustworthy and low maintenance tests. But choosing the right locators can sometimes become a challenging task.
Locators in selenium IDE
Locators tell on which GUI elements do Selenium IDE needs to operate on. The correct identification of the locators is very important and it is equally challenging.
There are many commands in Selenium IDE that does not require Locators, but most the commands do require locators. The locators to be used depends on the AUT.
The various types of locator are:
It is the common way to locate different elements as every element has a unique ID.
Consider any test app, let it be Facebook.
- Check the “Email” text box using Firebug and note down Locator: ID
- Launch Selenium IDE and write “id=(Locator ID you retrieved in the first step)” in the Target box. When you click on the Find button next to the target box, the “Email ID” text box will be emphasized with a yellow and green border. This means that Selenium IDE has located the “Email ID” text box correctly.
Locator name is quite similar to Locator: ID. The only difference is that here we use name instead of ID.
Target Format: name= name of the element.
Consider any test app, let it be Facebook.
- Check the “Email” text box using Firebug and note down Locator: Name
- Launch Selenium IDE and write “Name=(Locator name you retrieved in the first step)” in the Target box. When you click on the Find button next to the target box, the “Email ID” text box will be emphasized with a yellow and green border. This means that Selenium IDE has located the “Email ID” text box correctly.
This locator is used for hyperlink texts. It can be used by beginning the target with “link=” tailed by hyperlink text.
Consider any web app as a text app.
- Check any element that has a hyperlink text and using Firebug and notes down Link Text
- Launch Selenium IDE and write “Link =(Link Text you retrieved in the first step)” in the Target box. When you click on the Find button next to the target box, the corresponding text box will be emphasized with a yellow and green border. This means that Selenium IDE has located the element correctly.
CSS Selectors are though a complex method to locate elements on a web page, but they are the most preferred method of locating elements in advanced Selenium as they can even detect elements that have no name or no ID.
CSS Selectors are also string patterns That has the ability to recognize an element based on its arrangement of HTML tag, id, class, and attributes. CSS Selectors have many formats, but the most common are:
- Tag and ID
- Tag and class
- Tag and attribute
- Tag, class, and attribute
- Inner text
XPath is a language for navigating DOM (document object model) of a web page. It can locate any element on the web page and is hence the most potent and supple locator.
Some of the Firefox Add-ons that can help in finding XPath of an element:
The Document Object Model is an HTML document that can be accessed using JavaScript. It uses hierarchical dotted notation to locate an element on the page.
If you wish to learn more about selenium we have comprised a tutorial just for you which will take you deep into the tool. Click here
Originally published at https://www.testbytes.net on August 7, 2019.