Activity: Running a Script Against a Grid Hub

  1. Open the https://github.com/TrainingByPackt/BeginningSelenium/blob/master/docs/lesson_9/lesson9/src/test/java/com/ beginningselenium/examples/scripts/AgeCalculatorTestLocal.java file containing the automation script for the Age Calculator application.
  1. Declare the browser we want to use in the test, for that we can use the DesiredCapabilities object in the following way:
DesiredCapabilities desiredCapabilities = new DesiredCapabilities(new ChromeOptions());
  1. Change the line where we created the WebDriver from:
driver = new ChromeDriver();

to

driver = new RemoteWebDriver(new URL("http://localhost:4444/ wd/hub"), desiredCapabilities);
  1. Compile and run the test.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.236.62