Automated Testing - Getting Started with Selenium IDE

What is Selenium IDE?

Selenium is an add-on for Firefox that allows the user to automate interactions with the browser. It can be a great testing tool for a developer or QA/test engineer.

Download and Install Selenium IDE

Download Selenium IDE for your Firefox browser. The Selenium IDE icon will display in your Firefox toolbar once installed. Selenium IDE Icon

Let’s create a simple test case.

Go ahead and fire up Selenium by clicking the icon in the toolbar. You should see the following window appear. Selenium IDE

Enter the domain in the ‘Base URL’ field. Base URL Field

Create a command of ‘open’ with a target of ‘ / ‘. This will open up the website to the homepage. Open Command

Double click the line you just created and it will open the homepage in Firefox. Browser Displays Homepage

Now that we have the site open, we need to get Selenium to listen to us as we conduct a site search. In selenium, click the record icon. Hit the Record Button

Conduct a site search with a keyword of ‘Hotel’ or ‘Spa’. We will expect search results for these common keywords if the site search is functioning correctly. Search Results

Notice that Selenium recorded our actions as we interacted with the website. You should see new commands automatically added to our test case. Don’t forget to click the record icon again to stop recording your actions. More Commands

Select the ‘Play Current Test Case’ button to see the commands navigate the site again. Playing the Test Case

Now that our test case can conduct a site search we need to add a command that tells us if it fails or passes. Since we know those common keywords should display some search results, this test can verify that the ‘No Results Found’ message does NOT display. Add a command of ‘verifyTextNotPresent’ with a target of ‘No Results Found’. Run the test case. If it passes, it should look like this… Example of a Passing Test Case

A failing test case would look like this… Example of a Failing Test Case

Important Note

I’ve found that Selenium IDE is great for high level testing like the example above. It doesn’t replace Unit Testing by any means. Automatic testing through the UI can be a little unpredictable and generate a large number of false positives. However, when it comes to grindy tasks like filling in a form for the millionth time, Selenium is awesome.