Example usage for org.openqa.selenium.remote DriverCommand GET_CONTEXT_HANDLES

List of usage examples for org.openqa.selenium.remote DriverCommand GET_CONTEXT_HANDLES

Introduction

In this page you can find the example usage for org.openqa.selenium.remote DriverCommand GET_CONTEXT_HANDLES.

Prototype

String GET_CONTEXT_HANDLES

To view the source code for org.openqa.selenium.remote DriverCommand GET_CONTEXT_HANDLES.

Click Source Link

Usage

From source file:com.mengge.AppiumDriver.java

License:Apache License

@Override
public Set<String> getContextHandles() {
    Response response = execute(DriverCommand.GET_CONTEXT_HANDLES);
    Object value = response.getValue();
    try {/*from w w  w  .  j av a 2 s .com*/
        List<String> returnedValues = (List<String>) value;
        return new LinkedHashSet<>(returnedValues);
    } catch (ClassCastException ex) {
        throw new WebDriverException("Returned value cannot be converted to List<String>: " + value, ex);
    }
}

From source file:com.qmetry.qaf.automation.step.PerfectoMobileSteps.java

License:Open Source License

@SuppressWarnings("unchecked")
public static List<String> getContextHandles() {
    RemoteExecuteMethod executeMethod = new RemoteExecuteMethod(getDriver());
    List<String> contexts = (List<String>) executeMethod.execute(DriverCommand.GET_CONTEXT_HANDLES, null);
    return contexts;
}

From source file:io.appium.java_client.AppiumDriver.java

License:Apache License

@Override
public Set<String> getContextHandles() {
    Response response = execute(DriverCommand.GET_CONTEXT_HANDLES);
    Object value = response.getValue();
    try {//from   w  ww  .  j a v a2s.com
        List<String> returnedValues = (List<String>) value;
        return new LinkedHashSet<String>(returnedValues);
    } catch (ClassCastException ex) {
        throw new WebDriverException("Returned value cannot be converted to List<String>: " + value, ex);
    }
}

From source file:org.xframium.device.factory.DeviceWebDriver.java

License:Open Source License

public Set<String> getContextHandles() {
    if (contextHandles != null)
        return contextHandles;

    RemoteExecuteMethod executeMethod = new RemoteExecuteMethod((RemoteWebDriver) webDriver);
    List<String> handleList = (List<String>) executeMethod.execute(DriverCommand.GET_CONTEXT_HANDLES, null);

    contextHandles = new HashSet<String>(10);
    contextHandles.addAll(handleList);/* w ww .jav  a2  s.c o  m*/
    return contextHandles;
}