protected WebDriver createFirefoxDriver() {
return new FirefoxDriver();
}
protected WebDriver createHtmlUnitDriver() {
DesiredCapabilities capabilities = DesiredCapabilities.htmlUnit();
capabilities.setCapability(HtmlUnitDriver.INVALIDSELECTIONERROR, true);
capabilities.setCapability(HtmlUnitDriver.INVALIDXPATHERROR, false);
capabilities.setJavascriptEnabled(true);
if (browser.indexOf(':') > -1) {
// Use constants BrowserType.IE, BrowserType.FIREFOX, BrowserType.CHROME etc.
String emulatedBrowser = browser.replaceFirst("htmlunit:(.*)", "$1");
capabilities.setVersion(emulatedBrowser);
}
return new HtmlUnitDriver(capabilities);
}