Example usage for org.openqa.selenium.remote RemoteExecuteMethod RemoteExecuteMethod

List of usage examples for org.openqa.selenium.remote RemoteExecuteMethod RemoteExecuteMethod

Introduction

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

Prototype

public RemoteExecuteMethod(RemoteWebDriver driver) 

Source Link

Usage

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

License:Open Source License

@QAFTestStep(description = "open {appname} application")
public static void openApplication(String appName) {
    // open application command
    String command = "mobile:application:open";
    // open application
    getDriver().executeScript(command, ImmutableMap.of("name", appName));
    RemoteExecuteMethod executeMethod = new RemoteExecuteMethod(getDriver());
    executeMethod.execute(DriverCommand.SWITCH_TO_CONTEXT, ImmutableMap.of("name", "NATIVE"));
}

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

License:Open Source License

@QAFTestStep(description = "switch to {context-name} context")
public static void switchToContext(String context) {
    RemoteExecuteMethod executeMethod = new RemoteExecuteMethod(getDriver());
    executeMethod.execute(DriverCommand.SWITCH_TO_CONTEXT, ImmutableMap.of("name", context));
}

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: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:com.qmetry.qaf.automation.support.perfecto.PerfectoDriverListener.java

License:Open Source License

private void openApplication(QAFExtendedWebDriver driver, String appName) {
    PerfectoReportiumConnector.logTestStep("open '" + appName + "' application");
    // open application command
    String command = "mobile:application:open";
    // open application
    driver.executeScript(command, ImmutableMap.of("name", appName));
    RemoteExecuteMethod executeMethod = new RemoteExecuteMethod(driver);
    executeMethod.execute(DriverCommand.SWITCH_TO_CONTEXT, ImmutableMap.of("name", "NATIVE"));

}

From source file:io.selendroid.client.SelendroidDriver.java

License:Apache License

private SelendroidDriver(CommandExecutor executor, Capabilities caps) throws Exception {
    super(executor, caps);
    RemoteExecuteMethod executeMethod = new RemoteExecuteMethod(this);
    touchScreen = new RemoteTouchScreen(executeMethod);
    multiTouchScreen = new MultiTouchScreen(executeMethod);
    adbConnection = new RemoteAdbConnection(executeMethod);
    trackBall = new TrackBall(executeMethod);
}

From source file:io.selendroid.SelendroidDriver.java

License:Apache License

public SelendroidDriver(URL url, Capabilities caps) throws Exception {
    super(new SelendroidCommandExecutor(url), caps);
    RemoteExecuteMethod executeMethod = new RemoteExecuteMethod(this);
    touchScreen = new RemoteTouchScreen(executeMethod);
    adbConnection = new RemoteAdbConnection(executeMethod);
}

From source file:io.selendroid.SelendroidDriver.java

License:Apache License

public SelendroidDriver(Capabilities caps) throws Exception {
    super(new SelendroidCommandExecutor(), caps);
    RemoteExecuteMethod executeMethod = new RemoteExecuteMethod(this);
    touchScreen = new RemoteTouchScreen(executeMethod);
    adbConnection = new RemoteAdbConnection(executeMethod);
}

From source file:org.openqa.selendroid.SelendroidDriver.java

License:Open Source License

public SelendroidDriver(String url, Capabilities caps) throws Exception {
    super(new URL(url), caps);
    touchScreen = new RemoteTouchScreen(new RemoteExecuteMethod(this));
}

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

License:Open Source License

public WebDriver context(String newContext) {
    if (!contextSwitchSupported)
        return webDriver;

    if (newContext == null || newContext.equals(currentContext))
        return webDriver;

    if (webDriver != null) {

        if (webDriver instanceof RemoteWebDriver) {
            RemoteExecuteMethod executeMethod = new RemoteExecuteMethod((RemoteWebDriver) webDriver);
            Map<String, String> params = new HashMap<String, String>(5);
            params.put("name", newContext);
            executeMethod.execute(DriverCommand.SWITCH_TO_CONTEXT, params);
        } else if (webDriver instanceof AppiumDriver) {
            ((AppiumDriver) webDriver).context(newContext);
        } else/* ww w. j a  v a2 s.  c o  m*/
            return null;

        if (newContext.equals(_getContext()))
            currentContext = newContext;
        else
            throw new IllegalStateException(
                    "Could not change context to " + newContext + " against " + webDriver);
    }

    return webDriver;
}