Converting an existing test script to use the RemoteWebDriver server

Let's take a test script that we have executed locally; that is, where the test scripts and the browser were on the same machine:

@BeforeClasspublic void setup() {    System.setProperty("webdriver.chrome.driver",            "./src/test/resources/drivers/chromedriver");    driver = new ChromeDriver();}

The preceding test script creates an instance of Chrome Driver and launches the Chrome browser. Now, let's try to convert this test script to use Selenium Standalone Server that we started earlier. Before we do that, let's see the constructor of RemoteWebDriver, which is as follows:

RemoteWebDriver(java.net.URL remoteAddress, Capabilities desiredCapabilities)

The input parameters for the constructor ...

Get Selenium WebDriver 3 Practical Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.