Selenium offers a variety of tools to automate the Web application testing process across multiple platforms. It can run on many browsers and operating systems, and can be controlled by many programming languages, including Python, Perl, PHP, Ruby, Groovy and HTML. Selenium consists of three major tools: Selenium IDE, Selenium Remote Control (RC), and Selenium Grid. In this article, we will cover the first one.
Selenium IDE is the open source test automation tool to generate test cases. Firefox supports an add-on for Selenium IDE, with the same name. This is a user-friendly automation tool; anyone can develop and run individual test cases or entire test suites. The Selenium IDE can be used to generate the code for any of the programming languages mentioned above, with just a single click!
You can install the Firefox add-on from the relevant section on its website. Click the link to the
.xpi file in Firefox, and it will prompt you to install the add-on. Once the installation succeeds, restart your browser. After that, you can access the add-on via the Tools –> Selenium IDEmenu. The default screen looks like what is shown in Figure 1.
Recording is started automatically when the IDE is accessed. You can disable this option; uncheck the “Start recording immediately on open” option in the Options –> Options –> General tab.
The recorded actions are stored as Command, Target and Value in the Table view. The code can be viewed in the Source tab. By default, the code is generated in HTML format. The programming language can be specified via the Options –> Format menu.
During recording, the code is generated for an action. The response of the action is not verified. For example, let’s assume you are performing/recording a user creation action in the Web application. The recording action will generate code to create the user, but it cannot verify if the user has been successfully created. To verify the response, you can right-click on the text which you want to verify, and choose the VerifyTextPresent option. In this case, you can right-click on the text which informs you that user creation was successful.
The code can be saved as a test suite or a test case. A test suite is a collection of test cases.
You can click the Play the entire suite button to execute the test suite. You can also click the Play current test casebutton to execute a single test case. The difference in the appearance of these two buttons can be seen in Figure 2.
Figure 3 shows what the Selenium IDE Table view looks like after executing tests.
The Selenium IDE add-on provides a playback option for HTML code, but does not support playback for other programming languages. Test suites written or generated in other programming languages can be executed using the Selenium RC (Remote Control) tool — why don’t you try it out yourself? :-)
Thanks for posting this! I’m looking for a medium that can help us to get a good amount of promotion for my websites which in return gave me a business too through websites and I must say this has definitely helped me in this process.
When is the next article going to be published in this series?
Also hoping that you will cover regression testing with Selenium.