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:org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils.java

License:Open Source License

public static void initDriver() {
    try {//from   w w  w  .  j  a  v  a  2  s . co  m
        boolean remoteTesting = SetupCDTest.config.isRemoteTesting();
        if (!remoteTesting) {
            System.out.println("opening LOCAL browser");
            driver = new FirefoxDriver();

        } else {
            System.out.println("opening REMOTE browser");
            String remoteEnvIP = SetupCDTest.config.getRemoteTestingMachineIP();
            String remoteEnvPort = SetupCDTest.config.getRemoteTestingMachinePort();
            DesiredCapabilities cap = new DesiredCapabilities();
            cap = DesiredCapabilities.firefox();
            cap.setPlatform(Platform.WINDOWS);
            cap.setBrowserName("firefox");

            String remoteNodeUrl = String.format(SetupCDTest.SELENIUM_NODE_URL, remoteEnvIP, remoteEnvPort);
            driver = new RemoteWebDriver(new URL(remoteNodeUrl), cap);
        }

    } catch (MalformedURLException e) {
        throw new RuntimeException(e);
    }

}

From source file:org.openqa.grid.internal.utils.DefaultCapabilityMatcherTest.java

License:Apache License

@Test
public void platformMatchingTest() {
    DefaultCapabilityMatcher matcher = new DefaultCapabilityMatcher();
    Platform p = Platform.WINDOWS;

    Assert.assertTrue(matcher.extractPlatform("WINDOWS") == p);
    Assert.assertTrue(matcher.extractPlatform("xp").is(p));
    Assert.assertTrue(matcher.extractPlatform("windows VISTA").is(p));
    Assert.assertTrue(matcher.extractPlatform("windows 7").is(p));
}

From source file:org.qe4j.web.OpenWebDriver.java

License:Open Source License

/**
 * Constructs the property key to lookup the browser binary path.
 *
 * @param platform/*  w  w w. j a v a2s .  c  om*/
 * @param browser
 * @param version
 * @return property key to lookup browser binary else null if the binary is
 *         not found or definition indicates it should use the default
 *         binary
 */
protected String getBrowserBinaryPath(Platform platform, Browser browser, String version,
        Properties properties) {
    // determine platform part of property key
    String platformKeyPart = null;
    if (platform.is(Platform.LINUX)) {
        platformKeyPart = "linux";
    } else if (platform.is(Platform.WINDOWS)) {
        platformKeyPart = "win";
    } else if (platform.is(Platform.MAC)) {
        platformKeyPart = "mac";
    } else {
        throw new IllegalArgumentException("platform " + platform + " not currently supported");
    }

    String browserBinaryPropertyKey = "webdriver." + platformKeyPart + "." + browser.toString().toLowerCase()
            + "." + version;
    log.info("looking up webdriver browser binary path property {}", browserBinaryPropertyKey);
    String browserBinary = properties.getProperty(browserBinaryPropertyKey);

    if (browserBinary != null) {
        if (browserBinary.equals("")) {
            browserBinary = null;
        } else {
            log.info("using browser binary {}", browserBinary);
        }
    }

    return browserBinary;
}

From source file:org.qe4j.web.OpenWebDriver.java

License:Open Source License

/**
 * Converts the property definition of the platform to the Selenium enum
 * representation of it. Throws exception if the platform is not supported
 * by SauceLabs (current remote execution environment).
 *
 * @param platformProperty/*  ww  w. j a  v a2  s  .  c  o m*/
 * @return Selenium platform enum
 */
public static Platform lookupPlatform(String platformProperty) {
    String platform = platformProperty.toLowerCase();
    if (platform.equals("xp")) {
        return Platform.XP;
    } else if (platform.equals("vista")) {
        return Platform.VISTA;
    } else if (platform.equals("linux")) {
        return Platform.LINUX;
    } else if (platform.equals("windows")) {
        return Platform.WINDOWS;
    } else if (platform.equals("mac")) {
        return Platform.MAC;
    } else {
        throw new IllegalArgumentException(
                "platform property " + platformProperty + " is not currently supported for remote web driver");
    }
}

From source file:org.qe4j.web.OpenWebDriverTest.java

License:Open Source License

@Test
public void getBrowserBinaryPathPropKeyNotPresent() throws IOException {
    Properties properties = getProperties();
    properties.setProperty("webdriver.win.chrome.22", "/Test/binarypath");
    OpenWebDriver driver = new OpenWebDriver();
    String binaryPath = driver.getBrowserBinaryPath(Platform.WINDOWS, Browser.CHROME, "21", properties);
    Assert.assertNull(binaryPath, "property not present");
}

From source file:TenConcurrentUser.BFUIJobsExcnVldtnTest.java

License:Apache License

/**
 * @throws java.lang.Exception// www  .  jav  a 2s . com
 */
@Before
public void setUp(int address) throws Exception {
    System.setProperty("webdriver.gecko.driver", "/Users/Peizer/Downloads/geckodriver");
    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:test.java.com.uttesh.selenium.Tests.BaseTest.java

public WebDriver getRemoteWebDriver(String platform, String browser, String version, String url) {
    try {/*from   w w  w  .j av  a2s.c o m*/
        DesiredCapabilities capability = new DesiredCapabilities();
        if (platform.equalsIgnoreCase("Windows")) {
            capability.setPlatform(Platform.WINDOWS);
        }
        if (platform.equalsIgnoreCase("Linux")) {
            capability.setPlatform(Platform.LINUX);
        }

        if (browser.equalsIgnoreCase("Internet Explorer")) {
            capability = DesiredCapabilities.internetExplorer();
        }
        if (browser.equalsIgnoreCase("Firefox")) {
            capability = DesiredCapabilities.firefox();
        }
        capability.setVersion(version);
        driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);
        return driver;
    } catch (MalformedURLException ex) {
        Logger.getLogger(AmazonTest.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
}