Example usage for org.openqa.selenium Platform getCurrent

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

Introduction

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

Prototype

public static Platform getCurrent() 

Source Link

Document

Get current platform (not necessarily the same as operating system).

Usage

From source file:org.openqa.grid.common.RegistrationRequest.java

License:Apache License

private void addPlatformInfoToCapabilities() {
    Platform current = Platform.getCurrent();
    for (DesiredCapabilities cap : capabilities) {
        if (cap.getPlatform() == null) {
            cap.setPlatform(current);// ww  w .  java  2s  . c o m
        }
    }
}

From source file:org.openqa.grid.e2e.misc.Grid1HeartbeatTests.java

License:Apache License

@Test
public void testIsRegistered() throws Exception {
    // register a selenium 1
    SelfRegisteringRemote selenium1 = GridTestHelper.getRemoteWithoutCapabilities(hub.getUrl(), GridRole.NODE);
    selenium1.addBrowser(new DesiredCapabilities("*firefox", "3.6", Platform.getCurrent()), 1);
    selenium1.startRemoteServer();/*ww  w .  java  2  s  .c  o  m*/
    selenium1.sendRegistrationRequest();

    RegistryTestHelper.waitForNode(hub.getRegistry(), 1);

    // Check that the node is registered with the hub.
    URL heartbeatUrl = new URL(String.format("http://%s:%s/heartbeat?host=%s&port=%s", hub.getHost(),
            hub.getPort(), selenium1.getConfiguration().get(RegistrationRequest.HOST),
            selenium1.getConfiguration().get(RegistrationRequest.PORT)));

    HttpRequest request = new HttpGet(heartbeatUrl.toString());

    HttpClientFactory httpClientFactory = new HttpClientFactory();

    HttpClient client = httpClientFactory.getHttpClient();
    try {
        HttpHost host = new HttpHost(hub.getHost(), hub.getPort());
        HttpResponse response = client.execute(host, request);

        BufferedReader body = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));

        Assert.assertEquals(response.getStatusLine().getStatusCode(), 200);
        Assert.assertEquals(body.readLine(), "Hub : OK");
    } finally {
        httpClientFactory.close();
    }
}

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

License:Apache License

/**
 * Adding the browser described by the capability, automatically finding out what platform the
 * node is launched from ( and overriding it if it was specified )
 * //  ww  w.j a  v  a  2 s. com
 * @param cap describing the browser
 * @param instances number of times this browser can be started on the node.
 */
public void addBrowser(DesiredCapabilities cap, int instances) {
    String s = cap.getBrowserName();
    if (s == null || "".equals(s)) {
        throw new InvalidParameterException(cap + " does seems to be a valid browser.");
    }
    cap.setPlatform(Platform.getCurrent());
    cap.setCapability(RegistrationRequest.MAX_INSTANCES, instances);
    nodeConfig.getCapabilities().add(cap);
}

From source file:org.testeditor.fixture.web.json.BrowserSettingsManager.java

License:Open Source License

protected Platform getCurrentPlatform() {
    return Platform.getCurrent();
}