Example usage for org.openqa.selenium Platform is

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

Introduction

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

Prototype

public boolean is(Platform compareWith) 

Source Link

Document

Heuristic for comparing two platforms.

Usage

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

License:Open Source License

/**
 * Constructs the property key to lookup the browser binary path.
 *
 * @param platform//from w ww. j  a va 2s.  com
 * @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;
}