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

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

Introduction

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

Prototype

String GET_CURRENT_CONTEXT_HANDLE

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

Click Source Link

Usage

From source file:com.mengge.AppiumDriver.java

License:Apache License

@Override
public String getContext() {
    String contextName = String.valueOf(execute(DriverCommand.GET_CURRENT_CONTEXT_HANDLE).getValue());
    if (contextName.equals("null")) {
        return null;
    }/*from   w  w w  .j av  a2  s  .  c o m*/
    return contextName;
}

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

License:Open Source License

public static String getCurrentContextHandle() {
    RemoteExecuteMethod executeMethod = new RemoteExecuteMethod(getDriver());
    String context = (String) executeMethod.execute(DriverCommand.GET_CURRENT_CONTEXT_HANDLE, null);
    return context;
}

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

License:Open Source License

/**
 * _get context./*  w w  w  .j  av a  2 s  . c om*/
 *
 * @return the string
 */
private String _getContext() {
    if (webDriver != null) {
        try {
            if (webDriver instanceof RemoteWebDriver) {
                RemoteExecuteMethod executeMethod = new RemoteExecuteMethod((RemoteWebDriver) webDriver);
                return (String) executeMethod.execute(DriverCommand.GET_CURRENT_CONTEXT_HANDLE, null);
            } else if (webDriver instanceof AppiumDriver) {
                return ((AppiumDriver) webDriver).getContext();
            }
        } catch (Exception e) {
            log.warn("Context Switches are not supported - " + e.getMessage());
            contextSwitchSupported = false;
        }
    }

    return null;
}

From source file:org.xframium.utility.BrowserCacheLogic.java

License:Open Source License

private static String getCurrentContextHandle(RemoteWebDriver driver) {
    RemoteExecuteMethod executeMethod = new RemoteExecuteMethod(driver);

    String context = (String) executeMethod.execute(DriverCommand.GET_CURRENT_CONTEXT_HANDLE, null);

    return context;
}