• Selenium Video Tutorials

Selenium - Remote Control (RC)



Selenium is an open-source and a portable automated software testing tool for testing web applications. It has capabilities to operate across different browsers and operating systems. Selenium is not just a single tool but a set of tools that helps testers to automate web-based applications more efficiently. Selenium is often referred to as a suite of Selenium tools. There are a total of four tools which are together called the Selenium Components. They are known as −

  • Selenium IDE

  • Selenium RC

  • Selenium Webdriver

  • Selenium Grid

What is Selenium Remote Control?

Selenium Remote Control is a part of the Selenium suite and comprises the client libraries, and a server that opens and terminates the browser by default. It is a server implemented in Java. It can accept commands for browsers using the HTTP. In the current version of Selenium, Selenium Remote Control is outdated and it has been deprecated by Selenium.

Automation tests in Selenium Remote Control can be developed in any programming languages like Java, Python, C#, and so on. Selenium Remote Control can be used to write automated tests for testing web applications. Selenium Remote Control comprises a proxy server which gives the provision to the browser to work as if that the application under test is available in the domain of the proxy server. To initiate test execution, we have to first create an instance of the Selenium Remote Control server.

Selenium Remote Control (RC) was the main Selenium project that sustained for a long time before Selenium WebDriver(Selenium 2.0) came into existence. Now. Selenium Remote Control is hardly in use, as WebDriver offers more powerful features, however users can still continue to develop scripts using Selenium Remote Control.

It allows us to write automated web application UI tests with the help of full power of programming languages such as Java, C#, Perl, Python and PHP to create more complex tests such as reading and writing files, querying a database, and emailing test results.

Architecture of Selenium Remote Control

The architecture of Selenium Remote Control is described in the below diagram −

Selenium Remote Control

Selenium Remote Control architecture is not straightforward. In order to trigger tests in Selenium Remote Control, we would need to install and set up the Remote Control Server in our system. It is similar to a bridge between the web browser and the commands. Selenium Remote Control server puts the Selenium Core(a program in JavaScript) within the browser. Post this, the Selenium Core gets the message from the Selenium Remote Control server as per tests in the form of JavaScript commands. The browsers perform the commands received from the Selenium Core, and send test responses back to the server.

The Selenium Server acts as the central processor for your entire application. It receives the script for the test cases to be executed, interprets the command and reports back the test execution result. RC server binds the Selenium Core and automatically injects the script in the browser. All these actions are performed only after the test program has executed the browser using a client library API. The server works by receiving selenese commands which are transmitted over HTTP network in the action type as GET and POST, this makes us use any programming language to be used to pass these commands to the server.

The client libraries are the programming language-specific libraries which are used by testers to create the test scripts. These libraries are different for each language. They provide functions, which execute the selenium command. Each of the Selenese commands has corresponding functions already defined.

Limitations of Selenium Remote Control

The limitation of Selenium Remote Control is because of its complicated architecture. Besides, the test execution takes a lot of time and performance is not up to the mark. This is because the Selenium RC takes JavaScript commands as directions to the browser. The headless execution can not be implemented using the Selenium RC and its APIs are less object-oriented.

Installing Selenium Remote Control with Java

Prerequisites before installing the Selenium Remote Control −

Step 1 − Download and install Java from the below link −

https://www.oracle.com/java/technologies/downloads/.

To get a more detailed view on how set up Java, refer to the below link −

https://www.youtube.com/watch?v=bxIZ1GVWYkQ.

Once we have successfully installed Java, we can confirm its installation by running the command: java, from the command prompt.

C:\java 

It will display the following information on the screen −

Usage: java [options] <mainclass> [args...]
           (to execute a class)
   or  java [options] -jar <jarfile> [args...]
           (to execute a jar file)
   or  java [options] -m <module>[/<mainclass>] [args...]
       java [options] --module <module>[/<mainclass>] [args...]
           (to execute the main class in a module)
   or  java [options] <sourcefile> [args]
           (to execute a single source-file program)

 Arguments following the main class, source file, -jar <jarfile>,
 -m or --module <module>/<mainclass> are passed as the arguments to
 main class.

 where options include:

    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
    --class-path <class search path of directories and zip/jar files>
                  A ; separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -p <module path>
    --module-path <module path>...
                  A ; separated list of directories, each directory
                  is a directory of modules.
    --upgrade-module-path <module path>...
                  A ; separated list of directories, each directory
                  is a directory of modules that replace upgradeable
                  modules in the runtime image
    --add-modules <module name>[,<module name>...]
                  root modules to resolve in addition to the initial module.
                  <module name> can also be ALL-DEFAULT, ALL-SYSTEM,
                  ALL-MODULE-PATH.
    --enable-native-access <module name>[,<module name>...]
                  modules that are permitted to perform restricted native operations.
                  <module name> can also be ALL-UNNAMED.
    --list-modules
                  list observable modules and exit
    -d <module name>
    --describe-module <module name>
                  describe a module and exit
    --dry-run     create VM and load main class but do not execute main method.
                  The --dry-run option may be useful for validating the
                  command-line options such as the module system configuration.
    --validate-modules
                  validate all modules and exit
                  The --validate-modules option may be useful for finding
                  conflicts and other errors with modules on the module path.
    -D<name>=<value>
                  set a system property
    -verbose:[class|module|gc|jni]
                  enable verbose output for the given subsystem
    -version      print product version to the error stream and exit
    --version     print product version to the output stream and exit
    -showversion  print product version to the error stream and continue
    --show-version
                  print product version to the output stream and continue
    --show-module-resolution
                  show module resolution output during startup
    -? -h -help
                  print this help message to the error stream
    --help        print this help message to the output stream
    -X            print help on extra options to the error stream
    --help-extra  print help on extra options to the output stream
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions with specified granularity
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions with specified granularity
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:<libname>[=<options>]
                  load native agent library <libname>, e.g. -agentlib:jdwp
                  see also -agentlib:jdwp=help
    -agentpath:<pathname>[=<options>]
                  load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
                  show splash screen with specified image
                  HiDPI scaled images are automatically supported and used
                  if available. The unscaled image filename, e.g. image.ext,
                  should always be passed as the argument to the -splash option.
                  The most appropriate scaled image provided will be picked up
                  automatically.
                  See the SplashScreen API documentation for more information
    @argument files
                  one or more argument files containing options
    --disable-@files
                  prevent further argument file expansion
    --enable-preview
                  allow classes to depend on preview features of this release
To specify an argument for a long option, you can use --<name>=<value> or
--<name> <value>.

Step 2 − Next, we would confirm the version of the Java installed by running the following command −

java –version

It will show the following output −

openjdk version "17.0.9" 2023-10-17
OpenJDK Runtime Environment Homebrew (build 17.0.9+0)
OpenJDK 64-Bit Server VM Homebrew (build 17.0.9+0, mixed mode, sharing)

The output of the command executed signified that the java version installed in the system is 17.0.9.

The installation of Selenium Remote Control with Java is done by following the below steps −

Step 1 − Download Selenium Java client from the below link −

https://www.selenium.dev/downloads/.

Step 2 − Extract the jar file for selenium-java.

Step 3 − Install any code editor like IntelliJ, Eclipse, and so on to write and run the Selenium test. There are several editors available in the market for example: Eclipse, IntelliJ, Atom, and so on. Using these editors, we can start working on a Java project to start our test automation.

To get a more detailed view on how set up IntelliJ, refer to the below link −

https://www.tutorialspoint.com/selenium/intellij_selenium.htm.

Step 4 − Create a java project within the installed editor.

Step 5 − Add the selenium-java.jar files to the class path and references.

Step 6 − Create a Selenium test in Java.

Step 7 − Download and extract the Java jar file - selenium-server- standalone.jar in a location.

Step 8 − Navigate to the location where the Java jar file - selenium-server-standalone.jar is extracted.

Step 9 − Run the below command in the command line −

java -jar selenium-server-standalone-<version-number>.jar.

Step 10 − Execute the Selenium test developed in Step6 from the editor or from the command line.

This concludes our comprehensive take on the tutorial on Selenium - Remote Control (RC). We’ve started with describing what is Selenium Remote Control, what is the architecture of Selenium Remote Control, what are the limitations of Selenium Remote Control, and how to install Selenium Remote Control with Java.

This equips you with in-depth knowledge of the Selenium - Remote Control (RC). It is wise to keep practicing what you’ve learned and exploring others relevant to Selenium to deepen your understanding and expand your horizons.

Advertisements