com.sdl.selenium.utils.browsers.HtmlUnitConfigReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Testy Show documentation
Show all versions of Testy Show documentation
Automated Acceptance Testing. Selenium and Selenium WebDriver test framework for web applications.
(optimized for dynamic html, ExtJS, Bootstrap, complex UI, simple web applications/sites)
package com.sdl.selenium.utils.browsers;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.LocalFileDetector;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.io.IOException;
import java.net.URL;
public class HtmlUnitConfigReader extends AbstractBrowserConfigReader {
private static final String DEFAULT_CONFIG =
"\n browser=htmlunit";
public HtmlUnitConfigReader() {
this(null);
}
public HtmlUnitConfigReader(String resourcePath) {
super(resourcePath, DEFAULT_CONFIG);
}
@Override
public WebDriver createDriver() throws IOException {
return new HtmlUnitDriver(true);
}
@Override
public WebDriver createDriver(URL remoteUrl) throws IOException {
if (isRemoteDriver()) {
RemoteWebDriver driver = new RemoteWebDriver(remoteUrl, DesiredCapabilities.htmlUnit());
driver.setFileDetector(new LocalFileDetector());
return driver;
} else {
return createDriver();
}
}
@Override
public boolean isSilentDownload() {
return !"".equals(getProperty("browser.download.dir"));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy