Selenium is automating web applications for testing purposes. Nearly all of the software applications today are written as web-based applications to be run in an Internet browser. Now a day’s many organizations are using some form of Agile methodology, test automation is frequently becoming a requirement for software projects. Test automation means using a software tool to run repeatable tests against the application to be tested.
Advantages of the automation tools are repeatability of the tests and the speed at which the tests can be executed. Selenium is possibly the most widely-used open source solution. It support for several languages (Java, JavaScript, Ruby, PHP, Python, Perl and C#) and support for almost every browser out there.
Selenium IDE
Introduction - The Selenium-IDE (Integrated Development Environment) is the tool you use to develop your Selenium test cases. It’s an easy-to-use Firefox plug-in and is generally the most efficient way to develop test cases. It also contains a context menu that allows you to first select a UI element from the browser’s currently displayed page and then select from a list of Selenium commands with parameters pre-defined according to the context of the selected UI element.Installing Selenium IDE
Using Firefox browser first download the IDE from the SeleniumHQ Download page
When downloading from Firefox, you’ll be presented with the following window.
Select Install Now. The Firefox Add-ons window pops up, first showing a progress bar, and when the download is complete, displays the following.
Restart Firefox. After Firefox reboots you will find the Selenium-IDE listed under the Firefox Tools menu.
Opening Selenium IDE
To run the Selenium-IDE, simply select it from the Firefox Tools menu. It opens as follows with an empty script-editing window and a menu for loading, or creating new test cases.
IDE Features
File Menu Bar - The File menu has option for Test Case and Test Suite (suite of Test Cases). Using these you can add a new Test Case, open a Test Case, save a Test Case, and export Test Case in a language of your choice. You can also open the recent Test Case. All these options are also available for Test Suite.Toolbar - The toolbar contains buttons for controlling the execution of your test cases, including a step feature for debugging your test cases. The right-most button, the one with the red-dot, is the record button.
Speed Control: controls how fast your test case runs.
Run All: Runs the entire test suite when a test suite with multiple test cases is loaded.
Run: Runs the currently selected test. When only a single test is loaded this button and the Run All button have the same effect.
Record: Records the user’s browser actions.
Recording with Selenium IDE
Many first-time users begin by recording a test case from their interactions with a website. When Selenium-IDE is first opened, the record button is ON by default. If you do not want Selenium-IDE to begin recording automatically you can turn this off by going under Options > Options... and deselecting “Start recording immediately on open.”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 list box - select command
- clicking checkboxes or radio buttons - click command
With Selenium-IDE recording, go to the browser displaying your test application and right click anywhere on the page. You will see a context menu showing verify and/or assert commands.
Let’s see how this works. Open a web-page of your choosing and select a block of text on the page. A paragraph or a heading will work fine. Now, right-click the selected text. The context menu should give you a verifyTextPresent command and the suggested parameter should be the text itself.
Let Try right-clicking an image, or a user control like a button or a checkbox. You may need to use Show All Available Commands to see options other thanverifyTextPresent. Once you select these other options, the more commonly used ones will show up on the primary context menu. For example, selecting verifyElementPresent for an image should later cause that command to be available on the primary context menu the next time you select an image and right-click.
Opening and Saving Test Case
Save and Open commands under the File menu. However, Selenium distinguishes between test cases and test suites. To save your Selenium-IDE tests for later use you can either save the individual test cases, or save the test suite.
Commonly Used Selenium Command
OpenOpens a page using a URL.
Click/clickAndWait
Performs a click operation, and optionally waits for a new page to load.
Verify Title/assert Title
Verifies an expected page title.
VerifyTextPresent
Verifies expected text is somewhere on the page.
VerifyElementPresent
Verifies an expected UI element, as defined by its HTML tag, is present on the page.
Verify Text
Verifies expected text and its corresponding HTML tag are present on the page.
Verify Table
Verifies a table’s expected contents.
WaitForPageToLoad
Pauses execution until an expected new page loads. Called automatically when clickAndWait is used.
WaitForElementPresent
Pauses execution until an expected UI element, as defined by its HTML tag, is present on the page.
Go to Home Page
No comments:
Post a Comment
Thanks for your comment..! Keep commenting for more and more updates. To get post updates subscribe Blog or become a follower of this blog. Thanks Again..!