An Introduction to Selenium IDE
February 19th, 2007 byOn my current project we are building a web based application that allows the user to sign up for a service. The signup process is a series of pages for gathering a variety of information (about 8 or so pages). Now… I am a bit on the lazy side so a while back I started using the Selenium IDE to record scripts for moving me to the location in the app that I was interested in. The other day one of the non-techinical folk on the team asked me how to use the Selenium IDE and so I decided to write up a blog post about it. There are a couple of posts out there already in addition to the information on OpenQA but I figure one more post won’t hurt. It really is a very good tool for all types of people from sys admins, PM’s, Business Analysts, developers, to end users doing beta testing. I decided to break up the information based on questions I was asked when showing a couple of folks how to use the app.
What is Selenium?
OpenQA says: Selenium is a UI test tool for web applications. Selenium tests run directly in a browser, just as real users do. Those tests can run in Internet Explorer, Mozilla and Firefox on Windows, Linux, and Macintosh. No other test tool covers such a wide array of platforms.
What is Selenium IDE?
OpenQA says: Selenium IDE is an integrated development environment (thats what IDE stands for for those who don’t know) for Selenium tests. It is implemented as a Firefox extension, and allows you to record, edit, and debug tests. Selenium IDE includes the entire Selenium Core, allowing you to easily and quickly record and play back tests in the actual environment that they will run. Selenium IDE is not only a recording tool: it is a complete IDE. You can choose to use its recording capability, or you may edit your scripts by hand. With autocomplete support and the ability to move commands around quickly, Selenium IDE is the ideal environment for creating Selenium tests no matter what style of tests you prefer.
Installation:
A firefox extension is an installable enhancement to the browser’s functionality and add features to the application or allows existing features to be modified. Since Selenium IDE is a Firefox extension you get it by downloading and installing the firefox extension. Oh and installing extensions does require you to restart firefox so just keep that in mind before you go any further.
1. Go to OpenQA
2. Click the firefox extensions link under the download bullet of the latest version. This will pop up a box and a button should appear briefly that says “Install Now”. Click on that.
3. This will pop up a box and install the extension. Once its finished click the button on the bottom right corner that says “Restart Firefox”.
How do I run/use the Selenium IDE?
The folks over at OpenQA already did a nice movie so you can go watch that to get the basics.
How do I run a script that I recorded in Firefox against Internet Explorer?
You would need to install Selenium Core or Selenium RC in order to be able to do this. Selenium Core has to be run on the same webserver as the application you are trying to test. So this probably won’t work for non-developer types who don’t have access to what is put on the webserver. If that is the case then you might want to look into using Selenium RC.For information on using and setting up Selenium Core take a look Here and for using Selenium RC look Here.
What is the difference between run, walk, and step?
The only difference between run and walk is that run is faster. They behave exactly the same way. Step on the other requires you to actually push the blue downward right angle arrow key to continue to the next step. When you use Run and Walk with breakpoints the pause button will turn into a pause/resume button. In order to keep going to the next breakpoint just hit the pause/resume button. If you hit play again from a breakpoint or from any command it will start the script over from the beginning.
How do I use breakpoints?
Sometimes when you are running your scripts something breaks and you might want to see the state of the application just before that break or maybe the script exits before you get a chance to see the error on the screen in these cases breakpoints are awesome. Simply chose the line in your script where you want it to stop and put a break point. You do this by right clicking and selecting “Toggle Breakpoint”. Now when you hit the play button it will stop at that command. Additionally you can set a break point and then step through the application from that point on using the step feature.
Can you give an example of when you would want to save the scripts in a different language.
Sometimes QA people or Buisness Analysts or even end users may want to submit the test they used to create the error back to the developers, in this case the developers may like to have the test in the language which they are writing the application in. It may also be the case that the developers themselves change the language based on what they were given or who they may be giving the tests to. In order to change the language the test is output in go to the Selenium IDE tool bar select Options -> Format and then select the language you want the test in.
What is the difference between deleteCookie and deleteCookieAndWait?
In a nut shell don’t use the “andWait” commands. The “andWait” commands should be gone as of the latest version (they are still there but they all do the same things as their couterpart commands i.e deleteCookieAndWait does exactly what deleteCookie does) but for those still on the old version here is the explanation. Typically anytime you see the “andWait” or “withWait” piece tacked on to the end of a command it simply means that you want your script to stop executing any additional commands until it gets back a response saying the command has finished.
How would you handle situations where you would need to change a piece of data entered each time you run the script?
To be honest I haven’t quite figured out how to do this. I am going to try to play around with it a bit and see if I can figure something out. As soon as I do I’ll post an answer to this.
What does the log at the bottom tell me and how do I interpret what it is saying?
From the point of view of a non-technical person the log basically just tells you information about what has happened. Maybe you clicked the back button and the ide didn’t recognize that click and you then clicked some image. In this case you would get an error stating it could not find the element you told it to find. As it turns out the script isn’t on the right page so of course it wouldn’t find it. There are lots of reasons why you might get an error and usually if you step through your script you will find that you are not on the page you expect to be when the command was trying to be executed or some other trivial thing has happened. The log also has general information in the info tag that tells you which commands have been executed etc. All this maybe helpful when trying to figure out what has gone wrong.
Gotchas?
The most common gotchas are around timing and caching/session issues. There are a few commands that you can insert into your scripts in order to help you get around this. For instance if you have a page which has some ajax calls then you might have an issue where your script trys to do something before the call has actually finished. In this case you can insert the command “pause” into the script.
In another situation you may want to make sure that you are starting with a fresh session i.e. no cookies. The command “deleteCookie” can be used in order to make sure this happens.
A full list of Selenium commands can be found Here
So now you guys and girls go play around with it and post back your questions here. I’ll do my best to answer them or at least point you in the right direction.
Next post: Selenium On Rails!
Also check out these posts for information on Selenium IDE:
http://dynamitemap.com/selenium/ - very good introduction
http://ajaxian.com/archives/selenium-ide-07-released - some good questions and answers in the comments section

April 5th, 2007 at 1:01 pm
The site looks great ! Thanks for all your help ( past, present and future !)
April 26th, 2007 at 12:26 pm
> How would you handle situations where you would
> need to change a piece of data entered each time
> you run the script?
The overall topic covers doubleclicking, but the example also shows creating a random number and integrating into the data-entry.
*http://agiletesting.blogspot.com/2006/01/
testing-commentary-and-thus-ajax-with.html
HTH, Ted.
May 14th, 2007 at 1:05 am
how does this tool recognize an image in a web page?
Thanks in advance!!!!
May 15th, 2007 at 3:17 pm
Please let me know how to use selenium commands , send me syntax
thanks
May 25th, 2007 at 12:33 pm
Venu - selenium commands can be written in several different languages so I can’t really send you syntax. Please see http://www.openqa.org/selenium/ for more information and if you have specific questions I will be glad to help you out.
May 25th, 2007 at 12:45 pm
Morekuzambu - I am not sure what you mean but if you mean how do you assert on an image being there you basically use assertElementPresent I believe with the image as the target. Let me know if that is not what you were asking.
June 27th, 2007 at 11:48 pm
please tell me how to write scripts and explain all the commands and how exactly to go with it? Thanks in Advance.
June 28th, 2007 at 10:19 pm
Hi,
I have recently been playing a bit with selenium both the CORE and IDE versions, as my company has asked me to automate the testing process with Selenium.
Is there any way to data drive in selenium IDE and could we use data driven testing methods if yes I would sure like to know how. Hope you could help me out.
Thanks in Advance……..
Regards,
Supratim Modak
September 18th, 2007 at 3:16 am
What is the use of Selenium IDE extension and how to use it ?
How can we apply loops in Selenium IDE ???
Regards,
Akash Dhoundiyal
September 28th, 2007 at 3:42 pm
with regards to Supratim Modak on data driven testing…
The html table model used by selenium is a data driven key word model…
what I am assuming you mean is to parameterize data values in a base selenium test and then replace the values at run time…
I was actually thinking about this…
in your selenium html test you could parameterize your data with:
>>
you would then write a program would would open up your data table and you parameterized selenium test and iterate through it, replacing the values with a regex replace and create a unique test for each data row…
That is just a thought as I was thinking about the same thing my self…
October 5th, 2007 at 1:07 am
My company want to automate the testing process…
some one help me….
wheather Selenium IDE supports Regualar expression??? wheather parametrisation is possible by using selenium???
Thanks
Regards,
Paramesh
October 30th, 2007 at 2:57 am
hi,
i am the new user in selenium IDE i want to know how to automation down in selenium IDE .i can try to use the different method by using the different web site information .Then after i was known that it can be down by using test runner,but how to add code in test suite i can not understand . plz tell me with simple language.
thanks.
November 21st, 2007 at 7:02 am
Hello, Please may i get a help,
while recording a script using Selenium IDE tool, there is a javascript object which is not recording…
the code is:
Job Requirements:
var sBasePath = “/”;
oFCKrequirements = new FCKeditor( ‘jobrequirements’ ) ;
oFCKrequirements.BasePath = sBasePath ;
oFCKrequirements.Value = ” ;
oFCKrequirements.Create() ;
…
can someone help me to write is manually in the Selenium script, so as while playing the script the field will be filled?
February 27th, 2008 at 7:51 am
Hi
You cannot data drive/ parameterize using Selenium IDE or Core. For that you need to use Selenium RC, with which you can write a piece of code to fetch data from a text file or excel sheet as you wish.
And then execute the code. On the selenium rc server and execute the code with your compiler/interpreter.
I have a perl code for the same if any one is ineterested let me know.
Thanks
March 10th, 2008 at 4:41 am
Hi,
My company wants to automate the testing process…
some one help me….
How can i integrate selenium IDE with RC?
March 14th, 2008 at 1:06 am
Hi,
i recorded the sample test using selenium IDE, but if i playback the same i am unable to see the pop up window(which i have recorded earlier)
I am very new to selenium, can anyone guide me about it?
March 18th, 2008 at 1:51 pm
i am trying to use selenium in automating a website testing but we have light boxes opening up for few link and selenium does not capture whatever entered in light boxes.
can anyone help me out with this
April 11th, 2008 at 3:21 am
Hey Pallavi
I need to fetch data from a text file.
U said u have a perl code regarding that can u send me on my mail id.
Thanx
April 14th, 2008 at 5:19 am
Hi,
Does Selenium IDE support RIA(Rich Internet Applications) like GWT and AJAX based sites??
Here is the issue I’m experiencing while recording using Selenium IDE
- It does not record any scripts while using AJAX / GWT based Sites ( Our site is based on Compiere 3.0 with GWT)
- However, it records, ASP.NET 1.1 sites and works as expected.
Any Ideas ??
Thanks
April 15th, 2008 at 6:08 am
Please let me know how to fetch input data from excel sheet by selenium RC and how to take the detailed report.
Thanks and Regards,
NishNash
April 15th, 2008 at 10:44 pm
Hi NishNash
If you need to fetch data from an input excel file using Selenium RC you need to write the code for the same in a programming language which Selenium RC supports like Perl, ruby, Java etc.. there is no other way for it as far as i know.
So your program is the one which will read the input excel file and pass on the values to the objects you wish to parameterize.
Thanks,
April 15th, 2008 at 10:45 pm
Hi Malkeet
Send me your email id. post it here. and i will mail the code, or may be I will ask Desi to just send that to you. She has it.
thanks
April 15th, 2008 at 10:47 pm
Hi Sanskarsan
The selenium IDE and RC are two different components of selenium. you may use ide for recording and then using the same convert it in the programming language which the rc understands and that way you can work it out.
April 15th, 2008 at 10:50 pm
For everyone’s benefit here.. A general doubt regarding selenium comes whether we can do paramterization, use regular expression.. basically an we modify what we recorded using the IDE.
The answer is yes, we can by onverting the IDE recorded script into the programming language we are familiar with, the rc supports a lot of them like java, ruby, perl etc and you can do whatever you wish to using that script/code.
hope it helps.
April 16th, 2008 at 2:38 am
Hi Pallavi,
I would like to know how to get input data from excel sheet by selenium RC or IDE. Please send me the code in perl if you have.
And also I will be greatful if u would help me in recording alert windows using selenium IDE.
Hope you will do the needful
Thanks and Regards,
Mahesh
April 16th, 2008 at 3:08 am
Thanks Pallavi,
Can you please guide me for converting IDE code to RC code. I am using Perl Script for selenium.
Regards,
Nishnash
April 16th, 2008 at 4:50 am
Does Selenium IDE recognize java script? Actually i am working one SNS. To select the date,calenders are used, while recording the tests,it works fine, but when i run the tests,it takes the current date & then the test fails.
Can anyone help me?
April 18th, 2008 at 1:59 am
Hey,
Thanks for the info so far.
Problem now is that I am somewhat advanced in the tests but still struggle to “combine” all my tests, I know this can be done because with the Selenium install an extra is installed called “testrunner”!
Can someone please help me sort that part out?
Have a good one!
April 22nd, 2008 at 5:21 am
Hi Pallavi,
I wish to know how you were able to fetch data from a text file or excel sheet as you wish using Selenium RC.
Please do share the piece of code.
Thanx.
April 29th, 2008 at 12:26 am
Can we detect the broken and blurred images using the Selenium IDE??
April 30th, 2008 at 11:12 am
I’m new to Selenium IDE. Our website uses a lot of pop up windows. How does Selenium handle pop up windows?
Thanks
May 8th, 2008 at 11:44 pm
how to create test report in Selenium Core…?
May 15th, 2008 at 4:10 am
Hi,
Please give some information on to use the regexp with IDE?
Thanks
May 16th, 2008 at 6:56 pm
Hello, Can anybody send me the code of Parameterization using Java for Selenium. The scenario is as below:-
I have an excel sheet which has got a Username and Passowrd.In the webpage [developed using Java& Ajax]i have a two text fields and submit buton. I want to know how can we paramterize the test case.
May 20th, 2008 at 10:43 pm
Hi Pallavi,
I need to fetch data from Excel sheet for various fields like first name, Last name, address, etc…. So can you please share me the code of parameterization for Java???
May 26th, 2008 at 11:04 pm
Firstly, thanks for all of the information posted above.
2nd Can I also have the ‘looping’ code that will allow me to retrive data from a .xls and insert into a test, thus data driving my test cases.
3rd, i have used the Selenium ’storeText’ command to retrieve a date form a screen, now I need to add a number / variable to that date stored.
i.e. 21/3/2008 + 8 = 29/3/2008
any sugestions on how I accomplish this in Selenium?
June 2nd, 2008 at 2:56 am
Hello All,
I need to know how date driven testing is carried out using selenium IDE/RC.? If you have any code to do the same, please send it across.
Thanks in advance
June 4th, 2008 at 8:49 am
Hi ,
can any one tell me how to record/ or write script to capture image clik Useing Selenium. I am using Compiere Application & its using dynamic table structure.
It does not record any scripts while using AJAX / GWT based Sites ( Our site is based on Compiere 3.0.3 with GWT)
Regards
Mili
June 11th, 2008 at 3:36 am
Please let me know how to place comments in Selenium Html format,i mean is there any syntax to place comments in HTML formatt of SELENIUM IDE genrated code ???
June 17th, 2008 at 3:51 am
right click on command of selenium IDE IDE , click 9nsert comments , thats it simple :))
June 19th, 2008 at 7:14 am
Hi Pallavi,
I would like to know how to do data driven tests from Excell sheet. Can you please share me the code for Java you made?
Thank you.
June 23rd, 2008 at 3:39 am
i want to enter multiple data through selenium IDE (PARAMETRISATION) Is that possible to do that or for multiple data we have to use multiple scripts aslo in selenium IDE
June 24th, 2008 at 4:37 am
Hi,
can anyone please help in selenium . My company wants to automate the testing.so we choosed the selenium .I am new to this one.So please help me to work on it
thanks in advance
charan
July 22nd, 2008 at 8:54 am
I too would like to know how to perform “data driven” tests retrieving info from an Excel spreadsheet and/or text file.
Is this possible using HTML source/code? Perl Source/Code?
If so, can someone send to me a basic example?
Thanks!
MJ
July 23rd, 2008 at 7:47 am
hey,
I am trying to use Selenium to automate a website which uses lot of light boxes. Can you suggest a way to use selenium to recognise light boxes as it does not seem to work for me.
Thanks
Medha
August 7th, 2008 at 1:35 am
Hi,
I am new to selenium..
i am unable to get over a simple thing..
i want to know how to automate the scenario of closing the browser enabled pop-up windows as a part of my application testing.
EX:For a firefox browser,After logging into a web application,generally we can find the firefox popup ‘Do you want fire fox to remember password”.How do we automate this scenario..
I am using Selenium IDEv1.0 beta 1
I did try this by setting attributes
Command:windowFocus and Target as :Confirm
To be more clear,this is how my code looks like
command Target
//after entering my login credentials
ClickAndWait Login
//for pop-up window with title ‘Confirm’
windowFocus Confirm
close
Thanks & Regards,
Prasanna
August 18th, 2008 at 3:21 pm
Hi Pallavi (or anyone else that can help!)
Can I please have the code to fetch from a excel file? Thanks, Adam
August 26th, 2008 at 12:37 am
I am the new in Selenium. Can anybody tell me, how to create Test Case of Login page in Selenium?
January 15th, 2009 at 10:52 am
The selenium scripts you create CAN be run in any browser! Just select to “run in selenium test runner”. Another browser instance will then display. You can use test runner to test in any browser of your choice.
January 15th, 2009 at 10:54 am
Selenium scripts sometimes have to be edited in order to run them in test runner. You can slow them down manually but you probably want them to run quickly so that they can be automated. Just change the “click” to “clickAndWait” whenever a new page needs to load. Or add click/pause/click/pause when you are trying to click something in a modal popup window.
March 29th, 2009 at 4:48 am
hi everyone,
I am testing an application using selenium ide.This application generates ids dynamically each time certain fields are clicked.Right now i have to manually change these ids in script using xpath checker.I want a way out so that these ids get automatically captured and i dont need to chnage them each time i run test.Please help me out.
rashmi
April 7th, 2009 at 3:41 am
hi all,
i m new at selenium,i need to ask,i record a forum posting scenario but it doesn’t record when control goes to rich text field,please help me
May 12th, 2009 at 5:14 am
Hi Pallavi,
I need to fetch data from Excel sheet for various fields like first name, Last name, address, etc…. So can you please share me the code of parameterization in perl or ruby.
June 22nd, 2009 at 11:28 pm
Hi,
I am posting a small example on how to extract data from an external file for the login flow with username and password.
In a text file or excel have two fields.
username = “xyz”
password = “abc”
Make sure before you run the following script, the appropriate java classes are imported.
public class Login extends TestsDataSetUp
{
Properties pros = new Properties();
File fil = new File(”Logindetails.txt”);
public void setUp() throws Exception
{
FileInputStream fis = new FileInputStream(fil);
pros.load(fis);
super.setUp();
fis.close();
}
public void testnoDetails() throws Exception
{
String email = null;
String pass = null;
FileInputStream fis = new FileInputStream(fil);
selenium.open(”/home/”);
captureImage();
selenium.click(”enter the link which you want to open”);
for (int second = 0;; second++)
{
if (second >= 60) fail(”timeout”);
try { if (selenium.isVisible(”enter the login button id here”)) break; } catch (Exception e)
{
System.out.println(e);
}
Thread.sleep(1000);
}
try{
pros.load(fis);
email = pros.getProperty(”username”);
pass = pros.getProperty(”password”);
selenium.type(”loginName”, email);
selenium.type(”password”, pass);
selenium.click(”loginButton_button”);
if ((email.toString().equals(”")) && (email.toString().equals(”")))
{
for (int second = 0;; second++)
{
if (second >= 60) fail(”timeout”);
try { if (selenium.isElementPresent(”check for any element present for selenium to wait till that loads”))
break;
} catch (Exception e)
{
System.out.println(e);
}
Thread.sleep(1000);
}
}
fis.close();
}catch(Exception e){}
}
June 30th, 2009 at 9:25 am
Here is a link to perform data driven testing on Selenium IDE:
http://wiki.openqa.org/display/SEL/datadriven