Skip to content

Instantly share code, notes, and snippets.

@eliasnogueira
Created July 7, 2022 16:46
Show Gist options
  • Select an option

  • Save eliasnogueira/29795c9dc89f7f7e8b9b9861d87b32d0 to your computer and use it in GitHub Desktop.

Select an option

Save eliasnogueira/29795c9dc89f7f7e8b9b9861d87b32d0 to your computer and use it in GitHub Desktop.
Code snippet of the DriverFactory class showing only the createRemoteInstance method
private RemoteWebDriver createRemoteInstance(MutableCapabilities capability) {
RemoteWebDriver remoteWebDriver = null;
try {
String gridURL = String.format("http://%s:%s", configuration().gridUrl(), configuration().gridPort());
remoteWebDriver = new RemoteWebDriver(new URL(gridURL), capability);
} catch (java.net.MalformedURLException e) {
logger.log(Level.SEVERE, "Grid URL is invalid or Grid is not available");
logger.log(Level.SEVERE, String.format("Browser: %s", capability.getBrowserName()), e);
} catch (IllegalArgumentException e) {
logger.log(Level.SEVERE, String.format("Browser %s is not valid or recognized", capability.getBrowserName()), e);
}
return remoteWebDriver;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment