Created
November 9, 2011 13:12
-
-
Save freynaud/1351381 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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