CONTENTS OF THIS SITE

OUR OTHER CONTENTS

RECENT BLOG ENTRIES

An Introduction to Selenium IDE

February 19th, 2007 by comment desi

On 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?
Selenium IDEOpenQA 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

Comments

47 Responses to “An Introduction to Selenium IDE”

  1. morganusvitus says:


    The site looks great ! Thanks for all your help ( past, present and future !)

  2. Ted Husted says:


    > 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.

  3. Morekuzambu says:


    how does this tool recognize an image in a web page?

    Thanks in advance!!!!

  4. venu says:


    Please let me know how to use selenium commands , send me syntax

    thanks

  5. desi says:


    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.

  6. desi says:


    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.

  7. Yathish Aradhya says:


    please tell me how to write scripts and explain all the commands and how exactly to go with it? Thanks in Advance.

  8. Supratim says:


    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

  9. Akash Dhoundiyal says:


    What is the use of Selenium IDE extension and how to use it ?
    How can we apply loops in Selenium IDE ???
    Regards,
    Akash Dhoundiyal

  10. Hector says:


    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…

  11. Paramesh says:


    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

  12. smita says:


    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.

  13. Ramzi says:


    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?

  14. Pallavi says:


    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

  15. sankarsan says:


    Hi,
    My company wants to automate the testing process…
    some one help me….
    How can i integrate selenium IDE with RC?

  16. Elango says:


    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?

  17. Vemu says:


    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

  18. malkeet says:


    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

  19. Ravi says:


    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

  20. Nishnash says:


    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

  21. Pallavi says:


    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,

  22. Pallavi says:


    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

  23. Pallavi says:


    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.

  24. Pallavi says:


    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.

  25. Mahesh says:


    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

  26. Nishnash says:


    Thanks Pallavi,
    Can you please guide me for converting IDE code to RC code. I am using Perl Script for selenium.
    Regards,
    Nishnash

  27. Shital says:


    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?

  28. Orrin says:


    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!

  29. Preethi says:


    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.

  30. Pallavi says:


    Can we detect the broken and blurred images using the Selenium IDE??

  31. Carmen says:


    I’m new to Selenium IDE. Our website uses a lot of pop up windows. How does Selenium handle pop up windows?

    Thanks

  32. kumaresan says:


    how to create test report in Selenium Core…?

  33. Rajesh says:


    Hi,
    Please give some information on to use the regexp with IDE?

    Thanks

  34. Sabu says:


    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.

  35. Devaki says:


    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???

  36. Baxterelax says:


    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?

  37. Midhun says:


    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

  38. mili says:


    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

  39. virender Thakur says:


    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 ???

  40. virender Thakur says:


    right click on command of selenium IDE IDE , click 9nsert comments , thats it simple :))

  41. Tony says:


    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.

  42. gyanadeep says:


    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

  43. charan says:


    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

  44. MJ says:


    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

  45. Medha says:


    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

  46. prasanna says:


    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

  47. Ripon says:


    I am the new in Selenium. Can anybody tell me, how to create Test Case of Login page in Selenium?

Got something to say?