TestingDocs.com
Software Testing website
  • JBehave
  • Selenium
  • Testlink
  • Maven
  • Git
  • RAPTOR
  • Questions

RemoteWebDriver Tutorial

Tweet
Pin it

Document Contents

    • Introduction
  • RemoteWeDriver Server
    • Remote WebDriver client
    • Code Snippet

Introduction

In this post, we will discuss RemoteWebDriver. First of all, Remote WebDriver is an implementation class of the WebDriver interface that can use to execute test code on a remote machine via the RemoteWebDriver server. Furthermore, there are two parts to RemoteWebDriver. Also, you can find a pictorial view of the concept in the below diagram.

1.Server.(Server is  a Java servlet)
2.Client.( The client is your WebDriver test )

Selenium API

RemoteWeDriver Server

To Run the server

There are two ways to use the server: command line or configured in code.

To start the RemoteWebDriver server execute the following command on the remote machine.For example:
/>   java-jar selenium-server-standalone<<Version>>.jar

The server has 2 different timeouts, which can be set as follows:

java -jar selenium-server-standalone-<<VERSION>>.jar -timeout=30 -browserTimeout=90

 

 

RemoteWebDriver

 

 

browserTimeout :Controls how long in seconds the browser is allowed to hang.
timeout : Controls how long in seconds the client is allowed to be gone before the session is reclaimed.

Note that : If the Webdriver tests forget to terminate the remote sessions, then the server might leak memory. If you keep long-running sessions, then probably we need to stop/quit the server every now and then or increase memory with -Xmx jvm option.

Server as Servlet

The process is as simple as mapping the DriverServlet to a URL.Also, it is possible to host the web page in a lightweight container, such as Jetty or dedicated App server container like Tomcat or JBoss, if you run the servers for other purphose.

Remote WebDriver client

When you execute your tests locally, the WebDriver client libraries talk to your FireFox Driver or Edge Driver. When you try to execute your tests remotely. Furthermore, the WebDriver client libraries talk to the RemoteWebDriver server and the server talks to either the FireFox Driver, Edge Driver etc

Code Snippet

  public class SampleCodeExample {
      public static void main(String[] args){
         DesiredCapabilities capabilities =new DesiredCapabilities ();
         capabilities.setBrowserName("Firefox");
         RemoteWebDriver remotedriver =null;
        try{
              remotedriver = new RemoteWebDriver (newURL("http://
127.0.0.1:444/we/hub"),capabilities);
         }  catch (MalformedURLException e){
                e.printStackTrace();
           }
    }
}

 

You can view all of the sessions that are established with the RemoteWebDriver server by navigating to the default URL :  http://127.0.0.1:4444/we/hub. ( However, we can configure this too according to our own needs ).

 

Selenium WebDriver Tutorials on this website can be found at:

https://www.testingdocs.com/selenium-webdriver-tutorial

For more details on the Selenium, visit the official website at:

https://www.selenium.dev/

Related Posts

Selenium /

Getting Started with Selenium

Selenium /

Selenium 3.0 and Mozilla GeckoDriver

Selenium /

SauceLabs : Running an Example Sample Test

Selenium /

Create a new Project in Selenium IDE

Selenium /

Hub and Nodes Configuration

Tag Cloud

Agile Appium Tutorials C++ Eclipse Tutorials Git Tutorials IntelliJ Tutorials Java Java Tutorial JBehave Jenkins Jira Cloud JUnit Tutorial Maven Object-oriented Flowchart Python Tutorials Raptor Flowcharts Selenium IDE TestLink Tutorials

Random Posts

  • TestLink Bitnami Cloud Image
    Overview In this tutorial, we will see the steps

    Read more

  • Code Coverage Tools
    Overview Let’s look at some of the code coverage

    Read more

  • pCloudy Continuous Testing Cloud
    Overview pCloudy is a continuous testing cloud

    Read more

Latest Tweets

Tweets by @TestingDocs

Back to Top

TestingDocs.com

  • Privacy Policy
  • Cookie Policy
  • JBehave
  • Selenium
  • Testlink
  • Maven
  • Git
  • RAPTOR
  • Questions
www.TestingDocs.com | All Rights Reserved