Skip to content

Commit

Permalink
try to use default constructor if no caps are provided
Browse files Browse the repository at this point in the history
  • Loading branch information
klieber committed Jan 13, 2014
1 parent 26a954c commit adf2d60
Showing 1 changed file with 9 additions and 2 deletions.
Expand Up @@ -57,10 +57,17 @@ private Class<? extends WebDriver> getWebDriverClass() throws Exception {

private Constructor<? extends WebDriver> getWebDriverConstructor() throws Exception {
Class<? extends WebDriver> webDriverClass = getWebDriverClass();
boolean hasCapabilities = !webDriverCapabilities.isEmpty();
try {
return webDriverClass.getConstructor(Capabilities.class);
} catch (Exception exception) {
if (hasCapabilities) {
return webDriverClass.getConstructor(Capabilities.class);
}
return webDriverClass.getConstructor();
} catch (Exception exception) {
if (hasCapabilities) {
return webDriverClass.getConstructor();
}
return webDriverClass.getConstructor(Capabilities.class);
}
}

Expand Down

0 comments on commit adf2d60

Please sign in to comment.