Just a simple class depeciting the usage of a RemoteWebDriver which will be useful for any beginner...
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class TestRemote {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
DesiredCapabilities capability = DesiredCapabilities.firefox();
try {
WebDriver driver = new RemoteWebDriver(new URL("http://computername:4444/wd/hub"), capability);
driver.get("http://www.google.com");
} catch (MalformedURLException e) {
}
}
}
This will create a RemoteWebDriver which will run on a hub using firefox.
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class TestRemote {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
DesiredCapabilities capability = DesiredCapabilities.firefox();
try {
WebDriver driver = new RemoteWebDriver(new URL("http://computername:4444/wd/hub"), capability);
driver.get("http://www.google.com");
} catch (MalformedURLException e) {
}
}
}
This will create a RemoteWebDriver which will run on a hub using firefox.
Comments