Getting Started With Selenium IDE

As a technology geek, there’s perhaps no greater feeling than learning something new.  Ironically, we may all have times when that feeling comes less often, the further we progress in our careers.  Luckily for me, last Thursday was one of the more eye-opening days that I’ve had in awhile.

In my current role as a Senior Systems Administrator, I’m probably more concerned with setting up and maintaining file, application and web servers than with anything else.  It was in this capacity that I had a visit on Thursday from our Technical Account Manager for a leading provider of information security and compliance solutions.  While working with this vendor’s web application scanning product, an ancillary discussion turned me on to the free utility that we’re going to talk about today.

Selenium IDE is a Firefox plugin that allows one to record and play back any interactions that we could have within the web browser.  Do you need to test authentication to a web site or web application and execute a particular series of steps?  No problem.  Record it yourself and play it back when desired.  Do you need to run it a significant number of times as part of quality assurance or load testing?  Selenium can help you with that as well.  While Selenium wouldn’t necessarily replace purpose-built load-testing software, it’s more than adequate for repeating a consistent series of actions within a web application.  Let’s get started.

We’ll begin by downloading Selenium IDE.  (You might bookmark this page first, as you’ll want to refer back to it.)  After following the link, look for the words ‘Download latest released version,’ currently 1.10.0.  You’ll have to allow Firefox to install it, and then restart your browser.  Once you’ve installed Selenium IDE, let’s also install Selenium IDE: Flow Control.  Allow this installation and then restart Firefox one more time.

Once Selenium IDE and accompanying Flow Control are installed, you’ll see Selenium IDE as another option under the Tools menu in Firefox.  Go ahead and launch it.  Before we go any further, I recommend setting one Selenium option that has proven necessary in every instance of my very limited use so far.  Within Selenium’s Options > General tab, select ‘Record absolute URL’ as shown below.  I’ve yet to change any other options from the defaults.  Once you’ve set this option, go ahead and close Selenium for now.

Selenium Options

Having set our options, let’s talk about how to use Selenium.  When I’m ready to record a series of actions, I start with a blank tab in Firefox, and with Selenium closed.  Launching Selenium brings it up in record mode.  Simply complete a desired series of steps, and then stop the recording when finished.  At the end of the process, we’re left with a script that we can save and/or play again as desired.  Feel free to quickly record a process yourself.

Selenium script

Selenium IDE has recorded a series of web actions.

Now lets say that you want to repeat a series of actions several times without having to manually initiate it each time.  While Selenium supports variables and looping, I ran across a solution as simple as my first day of BASIC programming as a kid.  (Credit for this solution goes to Junior Mayhé via Stack Overflow.)  As we’ve already installed Flow Control, we can simply add a label at the top of a script and a gotolabel at the bottom, as illustrated below.  When Selenium reaches the end of your script, it will go to the beginning and continue.

Selenium labels

Begin with label your_start_point. End with gotolabel your_start_point.

With great power comes great responsibility.  It doesn’t take a lot of imagination to come up with various uses – both good and ill – for repeating a set of web actions ad infinitum.  Voting more than once to name something after Stephen Colbert of Comedy Central may well be harmless fun.  Contacting your Congressman 5,000 times regarding a single piece of legislation may not result in the outcome you were hoping for.

In completely unrelated news, the movie Zero Dark Thirty surged from seventh place to first place on the eve of the Academy Awards in one non-scientific opinion poll hosted by a major US entertainment magazine.

Tweet about this on TwitterShare on Google+Share on LinkedInShare on FacebookShare on RedditEmail this to someone

Speak Your Mind


Play CAPTCHA Audio
Reload Image