Example usage for org.openqa.selenium.remote CapabilityType PLATFORM_NAME

List of usage examples for org.openqa.selenium.remote CapabilityType PLATFORM_NAME

Introduction

In this page you can find the example usage for org.openqa.selenium.remote CapabilityType PLATFORM_NAME.

Prototype

String PLATFORM_NAME

To view the source code for org.openqa.selenium.remote CapabilityType PLATFORM_NAME.

Click Source Link

Usage

From source file:com.seleniumtests.browserfactory.IDesktopCapabilityFactory.java

License:Apache License

private MutableCapabilities updateDefaultCapabilities() {

    DesiredCapabilities capability = new DesiredCapabilities();

    if (webDriverConfig.isEnableJavascript()) {
        capability.setJavascriptEnabled(true);
    } else {/*from www  .j  a v  a  2  s. c o  m*/
        capability.setJavascriptEnabled(false);
    }

    capability.setCapability(CapabilityType.TAKES_SCREENSHOT, true);
    capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);

    if (webDriverConfig.getBrowserVersion() != null) {
        capability.setVersion(webDriverConfig.getBrowserVersion());
    }

    if (webDriverConfig.getWebPlatform() != null) {
        capability.setPlatform(webDriverConfig.getWebPlatform());
        capability.setCapability(CapabilityType.PLATFORM_NAME, webDriverConfig.getWebPlatform());
    }

    configureProxyCap(capability);

    // NEOLOAD //
    if (webDriverConfig.isNeoloadActive()) {
        if ("Design".equals(System.getProperty("nl.selenium.proxy.mode"))) {
            logger.warn(
                    "Enabling Neoload Design mode automatically configures a manual proxy through neoload instance, other proxy settings are overriden and network capture won't be possible");
        }
        try {
            capability = NLWebDriverFactory.addProxyCapabilitiesIfNecessary(capability);
        } catch (ExceptionInInitializerError e) {
            throw new ConfigurationException("Error while contacting Neoload Design API", e);
        } catch (RuntimeException e) {
            throw new ConfigurationException(
                    "Error while getting neoload project, check license and loaded project", e);
        }
    }

    return capability;
}