Selenium
Selenium
Introducing Selenium
Selenium is a robust set of tools that supports rapid development of test automation for web-based
applications. One of Selenium’s key features is the support for executing one’s tests on multiple browser
platforms.
Selenium Components
Selenium is composed of three major tools. Each one has a specific role in aiding the development of web
application test automation.
Selenium-IDE
Selenium-IDE is the Integrated Development Environment for building Selenium test cases. Selenium-
IDE has a recording feature, which will keep account of user actions as they are performed and store them
as a reusable script to play back.
Selenium-Grid
Selenium-Grid allows the Selenium-RC solution to scale for large test suites or test suites that must be run
in multiple environments
Test Suites
A test suite is a collection of tests. Often one will run all the tests in a test suite as one continuous batch-
job. When using Selenium-IDE, test suites also can be defined using a simple HTML file. The syntax
again is simple. An HTML table defines a list of tests where each row defines the file system path to each
test.
1. Recording
Many first-time users begin by recording a test case from their interactions with a website.
During recording, Selenium-IDE will automatically insert commands into your test case based on your
actions. Typically, this will include:
• clicking a link - click or clickAndWait commands
• entering values - type command
• selecting options from a drop-down listbox - select command
• clicking checkboxes or radio buttons - click command
2. Adding Verifications and Asserts With the Context Menu
Test cases will also need to check the properties of a web-page. This requires assert and verify
Commands. With Selenium-IDE recording, go to the browser displaying your test application and right
click anywhere on the page.
3. Editing
Insert Command
Table View
Select the point in your test case where you want to insert the command. To do this, in the Test Case
Pane, left-click on the line where you want to insert a new command. Right-click and select Insert
Command; the IDE will add a blank line just ahead of the line you selected. Now use the command
editing text fields to enter your new command and its parameters.
Source View
Select the point in your test case where you want to insert the command. To do this, in the Test Case
Pane, left-click between the commands where you want to insert a new command, and enter the HTML
tags needed to create a 3-column row containing the Command, first parameter (if one is required by the
Command), and second parameter (again, if one is required). Be sure to save your test before switching
back to Table view.
Reporting Results
Selenium-RC does not have its own mechanism for reporting results. Rather, it allows you to build your
reporting customized to your needs using features of your chosen programming language
Test design Considerations
The whole reason for using Selenium-RC is to add programming logic to the tests.
Iteration
Iteration is one of the most common things people need to do in their tests. For example, you may want to
execute a search multiple times
Condition Statements
A common problem encountered while running Selenium tests occurs when an expected element is not
available on page Condition statements are used in solve this problem.
Conclusion