All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.selendroid.SelendroidCommandExecutor Maven / Gradle / Ivy

There is a newer version: 0.17.0
Show newest version
/*
 * Copyright 2013-2014 eBay Software Foundation and selendroid committers.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package io.selendroid;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

import org.openqa.selenium.remote.CommandInfo;
import org.openqa.selenium.remote.HttpCommandExecutor;
import org.openqa.selenium.remote.HttpVerb;

public class SelendroidCommandExecutor extends HttpCommandExecutor {

  private final static Map SELENDROID_COMMANDS =
      new HashMap() {
        {
          // TODO remove airplaneMode once it is added and released in main Selenium library
          put("selendroid-getAirplaneMode", new CommandInfo(
              "/session/:sessionId/airplane_mode", HttpVerb.GET));
          put("selendroid-setAirplaneMode", new CommandInfo(
              "/session/:sessionId/airplane_mode", HttpVerb.POST));
          put("selendroid-getBrightness", new CommandInfo(
              "-selendroid/:sessionId/screen/brightness", HttpVerb.GET));
          put("selendroid-setBrightness", new CommandInfo(
              "-selendroid/:sessionId/screen/brightness", HttpVerb.POST));
          put("selendroid-getCommandConfiguration", new CommandInfo(
              "-selendroid/:sessionId/configure/command/:command", HttpVerb.GET));
          put("selendroid-setCommandConfiguration", new CommandInfo(
              "-selendroid/:sessionId/configure/command/:command", HttpVerb.POST));
          put("selendroid-adb-sendKeyEvent", new CommandInfo(
              "-selendroid/:sessionId/adb/sendKeyEvent", HttpVerb.POST));
          put("selendroid-adb-sendText", new CommandInfo("-selendroid/:sessionId/adb/sendText",
              HttpVerb.POST));
          put("selendroid-adb-tap",
              new CommandInfo("-selendroid/:sessionId/adb/tap", HttpVerb.POST));
          put("selendroid-adb-executeShellCommand",
            new CommandInfo("-selendroid/:sessionId/adb/executeShellCommand", HttpVerb.POST));
          
        }
      };

  public SelendroidCommandExecutor(URL url) throws MalformedURLException {
    super(SELENDROID_COMMANDS, url);
  }

  public SelendroidCommandExecutor() throws MalformedURLException {
    super(SELENDROID_COMMANDS, (URL) null);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy