info.novatec.testit.webtester.browser.factories.InternetExplorerFactory Maven / Gradle / Ivy
package info.novatec.testit.webtester.browser.factories;
import info.novatec.testit.webtester.browser.Browser;
import info.novatec.testit.webtester.config.Configuration;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.ie.InternetExplorerOptions;
/**
* Factory class for creating Internet Explorer {@link Browser} instances.
* Needs the {@code webdriver.ie.driver} system property pointing to the driver proxy server executable.
*
* The following capabilities are set by default:
*
* - Native Events are disabled
* - Unsigned certificates are accepted
*
* Additional information on using the {@link InternetExplorerDriver}:
*
* https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver
*
* @see Browser
* @see InternetExplorerDriver
* @since 2.1
*/
public class InternetExplorerFactory extends BaseBrowserFactory {
private static final String DRIVER_LOCATION = "webdriver.ie.driver";
public InternetExplorerFactory() {
super((capabilities) -> {
InternetExplorerOptions ieOptions = new InternetExplorerOptions().merge(capabilities);
return new InternetExplorerDriver(ieOptions);
});
}
@Override
protected void postProcessConfiguration(Configuration configuration) {
configuration.getStringProperty(DRIVER_LOCATION).ifPresent(driverLocation -> {
System.setProperty(DRIVER_LOCATION, driverLocation);
});
}
}