O'Reilly logo

Selenium WebDriver Practical Guide by Satya Avasarala

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Modifying the existing test script to use Selenium Grid

Until now, we have seen test scripts that run on our local machines or on Remote WebDriver servers. Executing test scripts on Selenium Grid is very similar to executing tests on Remote WebDriver, except that you will mention the platform details as well for Grid.

Let us look at a test script that uses the Remote WebDriver server:

public class UsingRemoteWebDriver {
  public static void main(String... args){
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setBrowserName("firefox");
    RemoteWebDriver remoteWD = null;
    try {
      remoteWD = new RemoteWebDriver(new URL("http://<remote-webdriver-ip>:4444/wd/hub"),capabilities); } catch (MalformedURLException e) { e.printStackTrace(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required