Thursday, June 30, 2011

RemoteWebDriver

We can run the tests in a remote machine by using remotewebdriver. For this user needs to start a server in the remote machine where he intends to run the test. More details are here    .

Once the server is started execute the below code.

   DesiredCapabilities desiredCapabilities = DesiredCapabilities.firefox();
//        URL remoteAddress = new URL("http://127.0.0.1:4444/wd/hub");
      HttpCommandExecutor executor = new HttpCommandExecutor(new URL("http://Remote address:4444/wd/hub"));
        WebDriver driver = new RemoteWebDriver(executor, desiredCapabilities);
          driver.get("http://www.google.com/");
          driver.quit();

We can see the firefox browser getting invoked in remote machine.