Example usage for org.openqa.selenium Platform WINDOWS

List of usage examples for org.openqa.selenium Platform WINDOWS

Introduction

In this page you can find the example usage for org.openqa.selenium Platform WINDOWS.

Prototype

Platform WINDOWS

To view the source code for org.openqa.selenium Platform WINDOWS.

Click Source Link

Document

Never returned, but can be used to request a browser running on any version of Windows.

Usage

From source file:com.vilt.minium.script.impl.InternetExplorerDriverFactory.java

License:Apache License

@Override
public WebDriver create(DesiredCapabilities capabilities) {
    Preconditions.checkArgument(Objects.equal(BrowserType.IE, capabilities.getBrowserName()));
    Preconditions.checkState(Platform.getCurrent().is(Platform.WINDOWS), "IE driver only supported in Windows");
    maybeInitInternetExplorerDriverService();
    WebDriver driver = new RemoteWebDriver(service.getUrl(), capabilities);
    return new Augmenter().augment(driver);
}

From source file:com.vilt.minium.script.impl.PhantomJsDriverFactory.java

License:Apache License

protected void maybeInitPhantomJsDriverService() {
    try {//  w w w. ja va 2  s  .  c  o m
        if (service == null) {
            String exe = Platform.getCurrent().is(Platform.WINDOWS) ? "phantomjs.exe" : "phantomjs";
            File phantomJsBin = new File(new File(preferences.getBaseDir(), "drivers"), exe);

            if (phantomJsBin.isFile() && phantomJsBin.canExecute()) {
                service = new PhantomJSDriverService.Builder().usingPhantomJSExecutable(phantomJsBin)
                        .usingAnyFreePort().build();
            } else {
                service = PhantomJSDriverService.createDefaultService();
            }
            service.start();
            logger.debug("PhantomJS driver service initialized: {}", service.getUrl());
        }
    } catch (IOException e) {
        throw Throwables.propagate(e);
    }
}

From source file:com.vilt.minium.script.MiniumScriptEngineTest.java

License:Apache License

@Test
public void testModulePathURIs() throws Exception {
    // given//from  ww  w . j a va2  s . co m
    System.setProperty("basedir",
            Platform.getCurrent().is(Platform.WINDOWS) ? "c:\\minium-app" : "/opt/minium-app");
    Reader reader = Resources.asCharSource(Resources.getResource("minium-prefs.json"), Charsets.UTF_8)
            .openStream();
    AppPreferences preferences = new AppPreferences(reader);
    MiniumScriptEngine engine = new MiniumScriptEngine(RhinoPreferences.from(preferences));

    // when
    List<String> modulePathURIs = engine.getModulePathURIs();

    // then
    String modules = Platform.getCurrent().is(Platform.WINDOWS) ? "file:/c:/minium-app/modules"
            : "file:/opt/minium-app/modules";
    assertThat(modulePathURIs, containsInAnyOrder(modules, "http://www.lodash.com"));
}

From source file:com.zaizi.automation.alfresco.core.info.TestCaseProperties.java

License:Open Source License

public static WebDriver gridDriver(String browser, String operatingSystem) throws MalformedURLException {
    if (driver != null) {
        closeDriver(driver);//www.j  av  a2  s.  c  om
    }
    if ("Firefox".equals(browser) && "MAC".equals(operatingSystem)) {
        DesiredCapabilities capability = DesiredCapabilities.firefox();
        capability.setBrowserName("firefox");
        capability.setCapability("ignoreZoomSetting", true);
        capability.setPlatform(Platform.MAC);
        capability.setVersion("ANY");
        capability.setCapability("nativeEvents", false);
        driver = new RemoteWebDriver(new URL(FFNODEURL), capability);
    } else if ("Firefox".equals(browser) && "VISTA".equals(operatingSystem)) {
        DesiredCapabilities capability = DesiredCapabilities.firefox();
        capability.setBrowserName("firefox");
        capability.setCapability("ignoreZoomSetting", true);
        capability.setPlatform(Platform.VISTA);
        capability.setVersion("ANY");
        capability.setCapability("nativeEvents", false);
        driver = new RemoteWebDriver(new URL(FFNODEURL), capability);
    } else if ("Firefox".equals(browser) && "WINDOWS".equals(operatingSystem)) {
        DesiredCapabilities capability = DesiredCapabilities.firefox();
        capability.setBrowserName("firefox");
        capability.setCapability("ignoreZoomSetting", true);
        capability.setPlatform(Platform.WINDOWS);
        capability.setVersion("ANY");
        capability.setCapability("nativeEvents", false);
        driver = new RemoteWebDriver(new URL(FFNODEURL), capability);
    } else if ("Chrome".equals(browser) && "VISTA".equals(operatingSystem)) {
        DesiredCapabilities capability = DesiredCapabilities.chrome();
        capability.setBrowserName("chrome");
        capability.setCapability("ignoreZoomSetting", true);
        capability.setPlatform(Platform.VISTA);
        capability.setVersion("ANY");
        capability.setCapability("nativeEvents", false);
        driver = new RemoteWebDriver(new URL(CHROMENODEURL), capability);
    } else if ("Chrome".equals(browser) && "MAC".equals(operatingSystem)) {
        DesiredCapabilities capability = DesiredCapabilities.chrome();
        capability.setBrowserName("chrome");
        capability.setCapability("ignoreZoomSetting", true);
        capability.setPlatform(Platform.MAC);
        capability.setVersion("ANY");
        capability.setCapability("nativeEvents", false);
        driver = new RemoteWebDriver(new URL(CHROMENODEURL), capability);
    } else if ("Chrome".equals(browser) && "WINDOWS".equals(operatingSystem)) {
        DesiredCapabilities capability = DesiredCapabilities.chrome();
        capability.setBrowserName("chrome");
        capability.setCapability("ignoreZoomSetting", true);
        capability.setPlatform(Platform.WINDOWS);
        capability.setVersion("ANY");
        capability.setCapability("nativeEvents", false);
        driver = new RemoteWebDriver(new URL(CHROMENODEURL), capability);
    } else if ("IE".equals(browser) && "VISTA".equals(operatingSystem)) {
        DesiredCapabilities capability = DesiredCapabilities.internetExplorer();
        capability.setBrowserName("internet explorer");
        capability.setCapability("ignoreZoomSetting", true);
        capability.setPlatform(Platform.VISTA);
        capability.setVersion("ANY");
        capability.setCapability("nativeEvents", false);
        capability.setCapability("name", "Remote File Upload using Selenium 2's FileDetectors");
        driver = new RemoteWebDriver(new URL(IENODEURL), capability);
    } else if ("IE".equals(browser) && "WINDOWS".equals(operatingSystem)) {
        DesiredCapabilities capability = DesiredCapabilities.internetExplorer();
        capability.setBrowserName("internet explorer");
        capability.setCapability("ignoreZoomSetting", true);
        capability.setPlatform(Platform.WINDOWS);
        capability.setVersion("ANY");
        capability.setCapability("nativeEvents", false);
        driver = new RemoteWebDriver(new URL(IENODEURL), capability);
    } else if ("Safari".equals(browser) && "MAC".equals(operatingSystem)) {
        DesiredCapabilities capability = DesiredCapabilities.safari();
        capability.setBrowserName("safari");
        capability.setCapability("ignoreZoomSetting", true);
        capability.setPlatform(Platform.MAC);
        capability.setVersion("ANY");
        capability.setCapability("nativeEvents", false);
        driver = new RemoteWebDriver(new URL(IENODEURL), capability);
    }
    return driver;
}

From source file:de.knowwe.uitest.UITestUtils.java

License:Open Source License

public static LinkedList<Object[]> getTestParameters() {
    LinkedList<Object[]> params = new LinkedList<>();
    params.add(new Object[] { "firefox", Platform.WINDOWS });
    //params.add(new Object[] { "firefox", Platform.LINUX });
    //params.add(new Object[] { "firefox", Platform.MAC });
    params.add(new Object[] { "chrome", Platform.WINDOWS });
    //params.add(new Object[] { "chrome", Platform.LINUX });
    //params.add(new Object[] { "chrome", Platform.MAC });
    return params;
}

From source file:EndToEnd.BFUIJobsExcnVldtnTest.java

License:Apache License

/**
 * @throws java.lang.Exception//  w  w w.j a va  2  s .co  m
 */
@Before
public void setUp(int address) throws Exception {

    baseUrl = "https://beachfront.stage.geointservices.io/";
    DesiredCapabilities capabilities = DesiredCapabilities.chrome();
    capabilities.setBrowserName("chrome");
    capabilities.setPlatform(Platform.WINDOWS);
    driver = new RemoteWebDriver(new URL(urls[address]), capabilities);
    driver.manage().timeouts().implicitlyWait(90, TimeUnit.MINUTES);
}

From source file:endtoend.browser.driver.builders.EdgeDriverBuilderTest.java

License:Apache License

@Test(expected = VerySpecialExceptionOnlyWeThrow.class)
@SuppressWarnings("deprecation")
public void withCapabilities() {
    // given/*from ww  w. j  a v  a  2s  .co  m*/
    DesiredCapabilities capabilities = new DesiredCapabilities("MicrosoftEdge", "", Platform.WINDOWS) {
        @Override
        public boolean is(String capabilityName) {
            throw new VerySpecialExceptionOnlyWeThrow();
        }
    };
    // when
    $.driver().useEdge().autoDriverDownload().withCapabilities(capabilities);
    DriverBuilderTestUtil.openAnyUrl();
    // then
    // exception is thrown when the browser inits with the passed capabilities
}

From source file:io.appium.java_client.localserver.ServerBuilderTest.java

License:Apache License

private static File findCustomNode() {
    Platform current = Platform.getCurrent();
    if (current.is(Platform.WINDOWS))
        return new File(String.valueOf(properties.get("path.to.custom.node.win")));

    if (current.is(Platform.MAC))
        return new File(String.valueOf(properties.get("path.to.custom.node.macos")));

    return new File(String.valueOf(properties.get("path.to.custom.node.linux")));
}

From source file:io.appium.java_client.pagefactory_tests.DesktopBrowserCompatibilityTest.java

License:Apache License

/**
 * The starting.//  w w w  .ja v  a2 s .c  o  m
 */
public void setUp() {
    if (current.is(Platform.WINDOWS)) {
        System.setProperty(ChromeDriverService.CHROME_DRIVER_EXE_PROPERTY,
                "src/test/java/io/appium/java_client/pagefactory_tests/chromedriver.exe");
    } else {
        System.setProperty(ChromeDriverService.CHROME_DRIVER_EXE_PROPERTY,
                "src/test/java/io/appium/java_client/pagefactory_tests/chromedriver");
    }
}

From source file:io.appium.java_client.service.local.AppiumServiceBuilder.java

License:Apache License

private static String returnCommandThatSearchesForDefaultNode() {
    if (Platform.getCurrent().is(Platform.WINDOWS))
        return COMMAND_WHICH_EXTRACTS_DEFAULT_PATH_TO_APPIUM_WIN;
    return COMMAND_WHICH_EXTRACTS_DEFAULT_PATH_TO_APPIUM;
}