Skip to content

Instantly share code, notes, and snippets.

@freynaud
Created November 9, 2011 13:12
Show Gist options
  • Save freynaud/1351381 to your computer and use it in GitHub Desktop.
Save freynaud/1351381 to your computer and use it in GitHub Desktop.
private URL findRemoteHost() throws MalformedURLException {
// new param after 2.9
String url = (String) config.get(REMOTE_HOST);
if(url!=null){
return new URL(url);
}else {
// could be a pre 2.9 node
url = (String) config.get("url");
if (url == null){
return null;
}else {
// was a legacy RC node. Needs to set that on the capabilities, as webdriver is the default.
if (url.contains("selenium-server/driver")){
List<DesiredCapabilities> capabilities = request.getCapabilities();
for (DesiredCapabilities capability : capabilities) {
capability.setCapability(SELENIUM_PROTOCOL, SeleniumProtocol.Selenium);
}
}
URL tmp = new URL(url);
return new URL("http://"+tmp.getHost()+":"+tmp.getPort());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment