Example usage for org.openqa.selenium.remote.html5 RemoteLocationContext RemoteLocationContext

List of usage examples for org.openqa.selenium.remote.html5 RemoteLocationContext RemoteLocationContext

Introduction

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

Prototype

public RemoteLocationContext(ExecuteMethod executeMethod) 

Source Link

Usage

From source file:com.google.iphone.testing.nativedriver.client.IosNativeDriver.java

License:Apache License

/**
 * Private method to set the geo location on the device or emulator
 *//* w  ww.  ja  v  a 2  s  .co  m*/
private void setLocation(Location loc) {
    RemoteLocationContext rc = new RemoteLocationContext(getExecuteMethod());
    rc.setLocation(loc);
}

From source file:com.mengge.AppiumDriver.java

License:Apache License

/**
 * @param executor is an instance of {@link org.openqa.selenium.remote.HttpCommandExecutor}
 *                 or class that extends it. Default commands or another vendor-specific
 *                 commands may be specified there.
 * @param capabilities take a look// ww w .jav a  2  s  .c  om
 *                     at {@link org.openqa.selenium.Capabilities}
 * @param converterClazz is an instance of a class that extends
 * {@link org.openqa.selenium.remote.internal.JsonToWebElementConverter}. It converts
 *                       JSON response to an instance of
 *                       {@link org.openqa.selenium.WebElement}
 */
protected AppiumDriver(HttpCommandExecutor executor, Capabilities capabilities,
        Class<? extends JsonToWebElementConverter> converterClazz) {
    super(executor, capabilities);
    this.executeMethod = new AppiumExecutionMethod(this);
    locationContext = new RemoteLocationContext(executeMethod);
    super.setErrorHandler(errorHandler);
    this.remoteAddress = executor.getAddressOfRemoteServer();
    try {
        Constructor<? extends JsonToWebElementConverter> constructor = converterClazz
                .getConstructor(RemoteWebDriver.class);
        this.setElementConverter(constructor.newInstance(this));
    } catch (NoSuchMethodException | IllegalAccessException | InstantiationException
            | InvocationTargetException e) {
        throw new RuntimeException(e);
    }
}

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

License:Apache License

public AppiumDriver(URL remoteAddress, Capabilities desiredCapabilities) {

    super(remoteAddress, desiredCapabilities);

    this.executeMethod = new AppiumExecutionMethod(this);
    this.remoteAddress = remoteAddress;
    locationContext = new RemoteLocationContext(executeMethod);

    ImmutableMap.Builder<String, CommandInfo> builder = ImmutableMap.builder();
    builder.put(RESET, postC("/session/:sessionId/appium/app/reset"))
            .put(GET_STRINGS, postC("/session/:sessionId/appium/app/strings"))
            .put(KEY_EVENT, postC("/session/:sessionId/appium/device/keyevent"))
            .put(CURRENT_ACTIVITY, getC("/session/:sessionId/appium/device/current_activity"))
            .put(SET_VALUE, postC("/session/:sessionId/appium/element/:id/value"))
            .put(PULL_FILE, postC("/session/:sessionId/appium/device/pull_file"))
            .put(PULL_FOLDER, postC("/session/:sessionId/appium/device/pull_folder"))
            .put(HIDE_KEYBOARD, postC("/session/:sessionId/appium/device/hide_keyboard"))
            .put(PUSH_FILE, postC("/session/:sessionId/appium/device/push_file"))
            .put(RUN_APP_IN_BACKGROUND, postC("/session/:sessionId/appium/app/background"))
            .put(PERFORM_TOUCH_ACTION, postC("/session/:sessionId/touch/perform"))
            .put(PERFORM_MULTI_TOUCH, postC("/session/:sessionId/touch/multi/perform"))
            .put(IS_APP_INSTALLED, postC("/session/:sessionId/appium/device/app_installed"))
            .put(INSTALL_APP, postC("/session/:sessionId/appium/device/install_app"))
            .put(REMOVE_APP, postC("/session/:sessionId/appium/device/remove_app"))
            .put(LAUNCH_APP, postC("/session/:sessionId/appium/app/launch"))
            .put(CLOSE_APP, postC("/session/:sessionId/appium/app/close"))
            .put(END_TEST_COVERAGE, postC("/session/:sessionId/appium/app/end_test_coverage"))
            .put(LOCK, postC("/session/:sessionId/appium/device/lock"))
            .put(IS_LOCKED, postC("/session/:sessionId/appium/device/is_locked"))
            .put(SHAKE, postC("/session/:sessionId/appium/device/shake"))
            .put(COMPLEX_FIND, postC("/session/:sessionId/appium/app/complex_find"))
            .put(OPEN_NOTIFICATIONS, postC("/session/:sessionId/appium/device/open_notifications"))
            .put(GET_NETWORK_CONNECTION, getC("/session/:sessionId/network_connection"))
            .put(SET_NETWORK_CONNECTION, postC("/session/:sessionId/network_connection"))
            .put(GET_SETTINGS, getC("/session/:sessionId/appium/settings"))
            .put(SET_SETTINGS, postC("/session/:sessionId/appium/settings"))
            .put(START_ACTIVITY, postC("/session/:sessionId/appium/device/start_activity"))
            .put(TOGGLE_LOCATION_SERVICES, postC("/session/:sessionId/appium/device/toggle_location_services"));

    ImmutableMap<String, CommandInfo> mobileCommands = builder.build();

    HttpCommandExecutor mobileExecutor = new HttpCommandExecutor(mobileCommands, remoteAddress);
    super.setCommandExecutor(mobileExecutor);

    super.setErrorHandler(errorHandler);
}