Testing web applications with Selenium IDE:

By Sandhya

Selenium is Open Source automation tool for Functional and Regression testing of web applications. It allows users to test across multiple browsers and platforms.  We can write Selenium scripts in many programming languages such as Java, PHP, Python, Ruby, Perl and C#.

Selenium has a suite of tools:

  • Selenium Core
  • Selenium 1/Selenium RC
  • Selenium 2/Selenium WebDriver
  • Selenium Grid
  • Selenium IDE

I use Selenium IDE (Integrated Development Environment). It is  a Mozilla Firefox plugin [Add-on] and is  easy to install. ..

Selenium has Recording and playback feature and provides facility to record actions in the Firefox browser and we also have the facility to modify the recorded script . We can run the recorded script, check for any errors and after modifying the script, it can be exported to  the selected programming language.

Here is the download link for Selenium IDE http://www.seleniumhq.org/download/


Open the Selenium IDE plugin,you can find Recording button on right top corner   of the IDE plugin and   by default the Record button is in recording mode. I have done some actions in the Firefox browser and recorded them in the IDE . Here is the screenshot:


It has two panels :Table and Source. My recorded script is in the table panel. Table panel has three columns:Command, Target and Value.Target is having identification of the element on which the command is passed. Identification of the element is to be done  by either of the following – link/ id/ Ui and css etc.

We can control the order of attributes [by using which Selenium finds/recognizes the elements] to save the target type in our record-script .[Go to Options in the Selenium IDE window, click on Options and go to Locator Builders. Drag and drop to change the order].By default the locator builder order is shown below:


So while recording, locator builder will try to recognize the element UI, if not found it will try to find its Id and then tries to find link etc. in that order. If we change the order as [Link, Ui, Id, Name..etc] then locator builder tries to find the Link of the element first. If it’s found, it gets saved in the script and if no link is found for selected element then it tries for Ui and keeps going down the list.

In the same Options window, we have General tab in which it has default time out option. The time out can be changed and set to desired time in milliseconds.

Modifications/Inserting verification statements:

I have debugged and modified the recorded script in the table panel itself. It has log and reference tabs at the bottom of the IDE window. Reference is having definition to the selected command and we can see the logs.

Click on Run Test Case , Observe the log and result . In my case it showed error saying

that “Element xxx not found” : One of the reasons for the error may be our script is too fast and  trying to find the element before the application loaded that element ; so we should add ‘wait’ in the script before the command  that triggered the error. In my script the error triggered after the command “click”, and to fix this issue,  I changed the script to “clickAndWait”.

We can add command manually on right click and by insert command.

To verify the availability of any element or text we can use two commands- verify and assert. The available commands to an element can be found in the browser itself by right clicking on the element as shown below:


I have inserted this verifyTextLink command to my Selenium IDE script by simply clicking on that command.

My script after verifyTextLink command insertion is shown below:



Run the recorded script:

I tried to run my script again and got an error in the log stating that  “Element xxx not found”. Since my script is already having wait, this time I fixed the error by selecting “slow” (In the toolbar option “fast-slow”). This runs the script in slow mode.



Debugging: We can debug the script line by line ,  keeping a breakpoint [Go to Actions, select Toggle Break point] and run the script line by line by clicking on step option [see the button  beside the play/pause button in the tool bar].  Below is the screenshot:




The script can be exported  as ” Java/J Unit/WebDriver “[ Java language/junit frame work/WebDriver frame work – we need to select from the list and has several options such as  Ruby, Python, Java, and C#]. We have an option to  export single test case or to export complete Test Suite. My script has Test Suite with two test cases; I have exported the complete Test Suite to “Java/JUnit/WebDriver “.Here is the screenshot:



Getting script of a selected command in selected programming language:

Go to Options in Selenium IDE Plug in, go to Clipboard Format and Select Java/JUnit 4/WebDriver. Copy the command to which you wanted script/code and paste in any java IDE. Here is the screen shot: