Java Code Examples for org.openqa.selenium.ie.InternetExplorerOptions#setCapability()

The following examples show how to use org.openqa.selenium.ie.InternetExplorerOptions#setCapability() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Browser.java    From coteafs-selenium with Apache License 2.0 6 votes vote down vote up
private static WebDriver setupIeDriver() throws MalformedURLException {
    LOG.i("Setting up Internet Explorer driver...");
    setupDriver(iedriver());
    final InternetExplorerOptions ieOptions = new InternetExplorerOptions();
    ieOptions.destructivelyEnsureCleanSession();
    ieOptions.setCapability("requireWindowFocus", true);
    ieOptions.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
    final InternetExplorerDriverService ieService = InternetExplorerDriverService.createDefaultService();
    if (!OS.isWindows()) {
        Assert.fail("IE is not supported.");
    }
    if (appSetting().isHeadlessMode()) {
        LOG.w("IE does not support headless mode. Hence, ignoring the same...");
    }
    return new InternetExplorerDriver(ieService, ieOptions);
}
 
Example 2
Source File: IECaps.java    From teasy with MIT License 6 votes vote down vote up
private InternetExplorerOptions getIEOptions() {
    InternetExplorerOptions caps = new InternetExplorerOptions();
    caps.setCapability("version", this.version);
    caps.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
    caps.setCapability(InternetExplorerDriver.IE_SWITCHES, "-private");
    caps.setCapability(InternetExplorerDriver.FORCE_CREATE_PROCESS, true);
    caps.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
    caps.setCapability(CapabilityType.SUPPORTS_ALERTS, true);
    caps.setCapability("platform", Platform.WINDOWS);
    caps.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
    caps.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, this.alertBehaviour);

    //Found that setting this capability could increase IE tests speed. Should be checked.
    caps.setCapability(InternetExplorerDriver.REQUIRE_WINDOW_FOCUS, true);
    setLoggingPrefs(caps);
    return caps;
}
 
Example 3
Source File: DriverFactory.java    From NoraUi with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Generates an ie webdriver. Unable to use it with a proxy. Causes a crash.
 *
 * @return
 *         An ie webdriver
 * @throws TechnicalException
 *             if an error occured when Webdriver setExecutable to true.
 */
private WebDriver generateIEDriver() throws TechnicalException {
    final String pathWebdriver = DriverFactory.getPath(Driver.IE);
    if (!new File(pathWebdriver).setExecutable(true)) {
        throw new TechnicalException(Messages.getMessage(TechnicalException.TECHNICAL_ERROR_MESSAGE_WEBDRIVER_SET_EXECUTABLE));
    }
    log.info("Generating IE driver ({}) ...", pathWebdriver);

    System.setProperty(Driver.IE.getDriverName(), pathWebdriver);

    final InternetExplorerOptions internetExplorerOptions = new InternetExplorerOptions();
    internetExplorerOptions.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
    internetExplorerOptions.setCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING, true);
    internetExplorerOptions.setCapability(InternetExplorerDriver.REQUIRE_WINDOW_FOCUS, true);
    internetExplorerOptions.setCapability(InternetExplorerDriver.NATIVE_EVENTS, false);
    internetExplorerOptions.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.ACCEPT);
    internetExplorerOptions.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
    internetExplorerOptions.setCapability("disable-popup-blocking", true);

    setLoggingLevel(internetExplorerOptions);

    // Proxy configuration
    if (Context.getProxy().getProxyType() != ProxyType.UNSPECIFIED && Context.getProxy().getProxyType() != ProxyType.AUTODETECT) {
        internetExplorerOptions.setCapability(CapabilityType.PROXY, Context.getProxy());
    }

    return new InternetExplorerDriver(internetExplorerOptions);
}
 
Example 4
Source File: CustomDriverProvider.java    From akita with Apache License 2.0 5 votes vote down vote up
/**
 * Задает options для запуска IE драйвера
 * options можно передавать, как системную переменную, например -Doptions=--load-extension=my-custom-extension
 *
 * @return internetExplorerOptions
 */
private InternetExplorerOptions getIEDriverOptions(DesiredCapabilities capabilities) {
    log.info("---------------IE Driver---------------------");
    InternetExplorerOptions internetExplorerOptions = !options[0].equals("") ? new InternetExplorerOptions().addCommandSwitches(options) : new InternetExplorerOptions();
    internetExplorerOptions.setCapability(CapabilityType.BROWSER_VERSION, loadSystemPropertyOrDefault(CapabilityType.BROWSER_VERSION, VERSION_LATEST));
    internetExplorerOptions.setCapability("ie.usePerProcessProxy", "true");
    internetExplorerOptions.setCapability("requireWindowFocus", "false");
    internetExplorerOptions.setCapability("ie.browserCommandLineSwitches", "-private");
    internetExplorerOptions.setCapability("ie.ensureCleanSession", "true");
    internetExplorerOptions.merge(capabilities);
    return internetExplorerOptions;
}
 
Example 5
Source File: InternetExplorerImpl.java    From frameworkium-core with Apache License 2.0 5 votes vote down vote up
@Override
public InternetExplorerOptions getCapabilities() {
    InternetExplorerOptions ieOptions = new InternetExplorerOptions();
    ieOptions.setCapability(CapabilityType.ForSeleniumServer.ENSURING_CLEAN_SESSION, true);
    ieOptions.setCapability(InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING, true);
    ieOptions.setCapability("requireWindowFocus", true);
    return ieOptions;
}
 
Example 6
Source File: LocalDriverFactory.java    From hsac-fitnesse-fixtures with Apache License 2.0 5 votes vote down vote up
public static InternetExplorerOptions getInternetExplorerOptions(Map<String, Object> profile) {
    InternetExplorerOptions ieOptions = new InternetExplorerOptions();
    if (profile != null) {
        for (Map.Entry<String, Object> profileEntry : profile.entrySet()) {
            ieOptions.setCapability(profileEntry.getKey(), profileEntry.getValue());
        }
    }
    return ieOptions;
}