What is selenium IDE:
Selenium-IDE (Integrated Development Environment) is a tool that you use to develop your Selenium test cases. It’s a Firefox plug-in. The 'record' button in selenium IDE enables user to record his actions and is a real time saver. Although, many-a-times, due to the external plugins used in our app, we need to manually write scripts or atleast modify the recorded scripts.
Why should developers know about selenium IDE?
In many of our applications, we have multiple forms and features that require testing/checking whenever we make slightest of change in our code. Selenium IDE provides an easy way to record steps in the form of selenium scripts, rather than manually checking/testing every time. This saves a lot of time and all we need is a Firefox add-on.
Some examples of basic usage of selenium IDE:
1) Navigating to an element:
html > body > form
2) Identify an input:
Consider an example of an input with id 'u1'
u1 (If only one element is present with this id)
3) Locate an element based on a partial id:
Many-a-times, we have elements that have Ids like 'list_item_1', 'list_item_2' or '1_list_item', etc.
In such cases, selenium ide uses the following syntax:
A) locating an element which starts from an id (example 'list_item_1')
B) locating an element which ends from an id (example: '1_list_item')
The above identification of elements and basics of selenium ide are well explained in the following videos:
While scripting with selenium IDE, many-a-times one might notice that their scripts indicated false failiure(or red tests). It is essential to identify the commands that cause these false negatives and to atmost avoid their usage.
One of the most commonly used event in selenium ide is the 'clickAndWait' event of selenium IDE. The clickAndWait event is mainly used when we have made a request and then we are asking the ide to wait for some time for recieving response from the server and then proceed furthur to execute next steps in the script.
The drawback of using this event is that, when the 'clickAndWait' expires, the command turns red(instead of green). This is an indication that the wait time has lapsed. Due to this, the end results/ outputs of the test is also indicated as 'red' or false failiure of the script. This can be misleading as the validations might be passing but your test might still be displaying a false failiure.
Thus, to avoid this we can replace 'clickAndWait' command with a cobination of two commands, as follows: 'Click' and then 'waitForElementPresent'. Using this combination a false negative is avoided. Other commonly used command that indicates a false negative is the 'pause' command.
Flow Control & Selenium IDE:
Adding flow control to selenium ide allows one to add multiple checks to their script. Some plugins enable adding flow control to our selenium scripts. One of the plugin is sideflow.js. The steps to install and use sideflow.js are mentioned on the following link:
[An Example of basic usage of selenium ide]
[List of all commands of selenium]