Before we can find out what Selenium RC does, understanding what Selenium does is crucial. Selenium is an open-source and free automated testing suite. Selenium has become very popular when it comes to automated web-based testing. Not only does it support a lot of different browsers and platforms, but it also competes very well against the available commercial tools - the HP UFT (Unified Functional Testing) or HP QTP (Quick Test Professional)
A mass movement towards automated testing can be seen in the current industry trend. The repetitive manual testing scenarios have created the demand for bringing the practice of automating the manual scenarios.
The execution of repeated test cases is supported through the automation.
When people start asking questions like "What is the best tool to automate the web-based tests?" or "Would it cost too much?" or "Would it be easy to adapt?", there can be a simple answer - Selenium. Selenium is preferred due to the following reasons:
[Also Read: Different Flavours Of Selenium]
Selenium is one of the most popular automated testing suites that can be found today. The tool is designed to encourage the automatic testing of the functions performed by web applications and a wide range of platforms and browsers. The acceptance has increased due to the open-source community that supports it.
Selenium RC is written in Java and allows the user to create test scripts for the web-based applications. The programming language can be anything that the user chooses. There were lots of disadvantages with Selenium IDE or Selenium core, which had been solved with the Selenium RC. There were loopholes and restrictions were imposed on the Selenium Core. That is why it was difficult for users to fully harvest the benefits of the tool. The testing process is a very cumbersome and tough task to achieve.
The working of the Selenium RC is based on its components. Each of the components has a role to play in running the test scripts.
The components of Selenium RC are responsible for the automation of the test scripts. They are:
The architecture of the Selenium RC is a client/server module. The clients and server communicate through appropriate internet protocols:
[For more information: How To Create Test Suites In Selenium]
Selenium commands in the test program are accessed through the simple HTTP requests of the Server. A programming language capable of sending HTTP requests can be used to automate the Selenium tests in the browsers.
The programming platform needed to run the commands from the designed program is offered by the client libraries. Another client library is supported for each of the supported languages. The Selenium client libraries would offer the application programming interface or API. This is a collection of functions that help to run the Selenium commands in the program. The programming function inside each interface supports each of the Selenium commands.
[Related Page: Blue Prism VS Selenium]
The APIs in the client libraries are responsible for passing the Selenese commands to a Selenium Server. The server then processes a specific function or conducts the tests with respect to the AUT or application under test. The APIs in the client libraries are also responsible for receiving the results and passing them to the program. The results can then be stored in a variable. The program might even report the incident as a failure or success. Corrective action can also take place if an undesired error had taken place.
The test program can be created by simply writing a program that runs some Selenese commands using the APIs in the client library. If there is a Selenium test script that has been developed in the IDE, the Selenium code can be generated as an alternative option. The IDE has the capability to translate the commands into the API function invocations of the client driver.
Selenium doesn’t need to be installed. There is a collection of libraries that need to be downloaded depending on the language you want to use. When the language has been chosen, you would need to:
[Also Read: Installation of Selenium IDE]
Now, it has to be extracted in the required directory.
That’s what is needed to be done to install the selenium server.
The server needs to be started before starting the tests. The user needs to move to the folder where the Selenium RCs are located and command needs to be run.
java -jar selenium-server-standalone-.jar
The process can be shortened by the creation of a shall executable or batch file(.sh in Linux or .bat on Windows) that contains the above command. A shortcut needs to be made to this executable file on the desktop. Double-clicking on the icon starts the server. However, Java would need to be installed on the system if you want to run the server, while the PATH variable needs to be correctly configured. You can see if the proper installation of Java has been done by using the following command.
A java version, if returned, you can use Selenium RC, considering the version is 1.5 or maybe later.
If you want to work with Selenium using Java, its client driver needs to be installed first. The steps explaining the usage of Java Client Driver are as follows.
You would need to have the Python Driver on the system before you can use Selenium. The steps explaining the usage of Python Driver are as follows.
[Click to know Selenium Commands: Selenium Commands]
The Ruby Client Driver is pretty easy to install. You should have it before you can work with the language.
[Also Read: How to use WebDriver Backed Selenium]
The Selenium API (Application Programming Interface) offers a platform that can be easily understood and explored. The APIs help to make the tests easier to read, code, and maintain. There is no tying to any particular test framework and can be used equally well with the old method.
The Selenium API utilizes naming conventions which can be understood if someone knows Selenese and much of this interface needs to be understood on your own. However, there are a few aspects that are a little less obvious and are yet very crucial. The browser can be represented by allocating a 'browser interface' to the program variable. The program variable calls function through the browser, which executes the Selenese commands. Some of the commands that can be used include type or open and verify.
A few parameters are required when the browser instances are being created. They are mentioned below.
A few client libraries would need that the browser is started forcefully through the start() method.
[Related Page: Introduction to Selenium 2.0 Webdriver]
Once the browser has been initialized and its reference has been assigned in a variable, the Selenese commands can be run by invoking the required methods referring that browser variable. The type function can be called in the manner:
selenium.type("field-id", "string to type")
The browser would perform the type of operation in the background. This would be identical to the user typing the input to a browser. The locator along with the string mentioned during the function invocation would be used.
[Creating Selenium test suites: How to Create test suites in Selenium]
There is no mechanism that Selenium RC has for reporting the results. The users are allowed to build the customizing according to their needs and the features of the selected programming language can be used. This idea works quite well, but what would the users do if they need something quick that has been already prepared for them. The existing test framework or library would meet the needs quicker than the reporting code developed by you.
The test frameworks can be availed for most of the programming languages. They offer a test engine that is flexible enough to execute the tests. There is a library code that helps to report the results as well. There are two very common test frameworks in Java - TestNG and JUnit. NUnit is used for .NET platforms.
Third-party libraries specially designed for reporting the test outcomes in the desired programming language are also available. A lot of formats like PDF or HTML are also supported.
Most people who are starting with testing frameworks would like to commence with the available reporting features of the frameworks. Then people start exploring those libraries which would be less bothering than developing something on your own. But as people start to operate Selenium, they start introducing their own signature print statements in order to report the progress. This often results in the users developing their own reporting and using it along with the library or the test framework.
Command-line options can be used to change the default server behavior when the server is launched. The server is started by running the following command:
java -jar selenium-server-standalone-.jar
$ java -jar selenium-server-standalone-.jar -h
[For More Information click: How to work on pages with AJAX in selenium?]
If the AUT is behind an HTTP proxy and requires authentication, you would need to configure http.proxyUser, http.proxyPassword, http.proxyPort and http.proxyHost. The following command does the job:
$ java -jar selenium-server-standalone-.jar -Dhttp.proxyHost=proxy.com -Dhttp.proxyPort=8080 -Dhttp.proxyUser=username -Dhttp.proxyPassword=password
Multi-Window mode is the default behavior since Selenium 1.0. The multi-window mode allows the AUT to run in a separate window and not in the default frame. The multi-window mode can be specified using the command:
[Related Page: Top 10 Reasons Why You Should Learn Selenium]
Selenium RC is one of the most common automated testing tools today. The advantages of Selenium RC are listed below.
Though Selenium RC is very popular today, it has a few drawbacks. Let’s have a look at them.
The Selenium Remote Control and WebDriver allow the testers to use their programming language of choice for the test scripts. The tests can be run in different browsers, but they do differ in certain scenarios. Let’s differentiate between Selenium RC and WebDriver in a tabular form.
|Selenium RC has a much-complicated architecture. An application named Selenium Remote Control needs to be run before the tests can be started.||WebDriver has a simple architecture - the browser is controlled from the OS level and you just need the language IDE.|
|3.||Selenium Core can access disabled elements.||WebDriver interacts with the pages more realistically.|
|4.||Selenium RC has a much more mature API but there are redundancies and confusing commands.||WebDriver has a simpler API, without redundancies and confusing commands.|
|5.||The headless htmlUnit browsers are not supported on Selenium RC. A real and visible browser is needed by Selenium RC.||WebDriver can support the headless htmlUnit browser.|
Selenium offers a portable framework to automate web-based testing. It offers playback for the functional tests where there would be no need to learn the scripting language. These tests would have the capability to run on most of the modern browsers. Being open-source, the developers are allowed to download it for free and use it without being charged.
Free Demo for Corporate & Online Trainings.