Selenium is a suite of tools and portable software testing framework that supports automate web application testing across many platforms. It is a web based automation tool. It supports various browsers on various platforms. It is primarily developed in Java Script and browser technologies and hence supports all the major browsers on all the platforms.
Selenium provides a record/playback tool for authoring tests without learning a test scripting language. The tests can be written as HTML tables or coded in a number of popular programming languages and can be run directly in most modern web browsers. Selenium can be deployed on Windows, Linux, and Macintosh. It has bindings for many different languages (including Java, Python, Perl, C# and PHP). With it you can create a suite of tests which can run tests in multiple browsers (including IE, Opera, Firefox and Safari).
Selenium Supported browsers are Internet Explorer, FireFox, Opera, Safari, and Sea monkey.
Selenium Supported Operating Systems are Windows, Linux, Solaris, and OS X.
Selenium Supported Programming languages are C# (DotNet), Java, Perl, Ruby, Python, and PHP.
Use of Selenium
Selenium can be used as a Functional & Regression test tool (selenium IDE is a plug-in to firefox) to record and playback tests (like Winrunner and QTP). We can then export the recorded tests in most language e.g. html, Java, .net, perl, ruby, etc. These exported tests can be run in any browser and any platform using “selenium remote control”.
Selenium components can be used in isolation or in combination to create complete automation suite for the web applications. Each one has a specific role in aiding the development of web application test automation.
Selenium components are as follows:
1. Selenium IDE.
2. Selenium Core.
3. Remote Control.
4. Selenium Grid.
5. Selenium WebDriver.
Selenium IDE is an integrated development environment for Selenium test cases. It operates as a Mozilla Firefox add on and also export tests in different languages and provides an easy to use interface for developing and running individual test cases or entire test suites. Selenium-IDE also offers full editing of test cases for more precision and control. The most appealing format is the html test case, which seems to be based on fit html.
Selenium RC (Remote Control)
Selenium Grid allows easily to run multiple tests in parallel on multiple machines by cutting down the time required for test execution. Selenium Grid can be used to run multiple instances of Selenium RC on various operating system and browser configurations.
This Selenium Grid has two components. They are Selenium Hub and Remote Control. First the hub receives requests from tests (the same as Selenium RC) and then allocates remote controls that are registered to the hub to each test. Testers can run tests without code changes in Selenium Grid. If once familiar with Selenium RC then we can easily able to run tests with Selenium Grid. We can also run existing code in parallel on multiple machines, which save test execution time and quickly yields feedback of test results. However, Selenium Grid itself does not provide a parallel running strategy. If we want to take advantage of Selenium Grid, we need to write our selenium tests in parallel mode.
WebDriver is designed to providing a simpler and more concise programming interface along with addressing some limitations in the Selenium-RC API. It was developed to better support dynamic web pages where elements of a page may change without the page itself being reloaded. This WebDriver’s goal is to supply a well-designed object-oriented API that provides improved support for modern advanced web-app testing problems. This Selenium-WebDriver makes direct calls to the browser using each browser’s native support for automation.
The Selenium commands often called as selenese. The set of these commands are nothing but test script. If we want to write test scripts for any application, then initially we need to integrate Selenium with Java by using Eclipse. After completion of the integration, first we need to create the selenium object.
Testing with Selenium
• In Selenium, we can perform Regression testing by writing Reusable Scripts in the form of Functions or Methods.
• With Selenium, we can perform Retesting with looping concepts.
• We can validate the application by using conditional statements.
• In Selenium, we can perform Database testing and reporting of the test results.
• In Selenium, we can do test case grouping, re-execution of failed test cases, and screenshot capture of test failures.
Advantages of Selenium
• Selenium is an Open source tool.
• Selenium IDE is the only flavor of Selenium, which allows you to record user action on browser window.
• It is simple, easy to install, and easy to work.
• During recording, if you right click on any element it will show all the selenium commands available.
• We can edit existing command, by selecting it and editing on the boxes available. We can also insert/delete commands by choosing appropriate option after right clicking.
Disadvantages of Selenium
• Limitation of browser support (It runs only in Mozilla). Scripts written using Selenium IDE can be used for other browsers only if it is used with Selenium RC or Selenium Core.
• Not allowed to write manual scripts like conditions and Loops for Data Driven Testing.
• We can’t run recorded script if it is converted to Java, C#, Ruby etc.