Package org.uiautomation.ios.communication

Examples of org.uiautomation.ios.communication.WebDriverLikeRequest


    return builder.toString();
  }


  public void flickInsideWithOptions(int touchCount, UIAPoint startOffset, UIAPoint endOffset) {
    WebDriverLikeRequest request = buildRequest(WebDriverLikeCommand.FLICK_INSIDE_WITH_OPTIONS,
                                                ImmutableMap.of("touchCount", touchCount, "xstart",
                                                                startOffset.getX(), "ystart",
                                                                startOffset.getY(),
                                                                "xend", endOffset.getX(), "yend",
                                                                endOffset.getY()));
View Full Code Here


  @Override
  public Point getLocation() {
    System.out.println("getLocation in RemoteUIAElement");

    WebDriverLikeRequest request = buildRequest(WebDriverLikeCommand.RECT);
    Map<String, Object> rect = commandExecutor.execute(request);
    Map<String, Long> origin = (Map<String, Long>) rect.get("origin");

    Long x = origin.get("x");
    Long y = origin.get("y");
View Full Code Here

  }

  @Override
  public void setValue(CharSequence... keysToSend) {

    WebDriverLikeRequest request = buildRequest(WebDriverLikeCommand.SET_VALUE,
                                                ImmutableMap.of("value", keysToSend));
    commandExecutor.execute(request);
  }
View Full Code Here

  public RemoteUIAPicker(RemoteWebDriver driver, String reference) {
    super(driver, reference);
  }

    public ArrayList<UIAElement> getWheels() {
        WebDriverLikeRequest request = buildRequest(WebDriverLikeCommand.PICKER_WHEELS);
        return commandExecutor.execute(request);
    }
View Full Code Here

    public RemoteUIASlider(RemoteWebDriver driver, String reference) {
        super(driver, reference);
    }

    public void dragToValue(double value) {
        WebDriverLikeRequest request = buildRequest(WebDriverLikeCommand.SLIDER_DRAG_TO_VALUE,
                ImmutableMap.of("dragToValue", String.valueOf(value)));
        commandExecutor.execute(request);
    }
View Full Code Here

      JSONObject payload = new JSONObject().put(key, value);
      Path p = new Path(WebDriverLikeCommand.CONFIGURE);
      // session/:sessionId/configure/command/:command
      p.validateAndReplace(":sessionId", driver.getSessionId().toString());
      p.validateAndReplace(":command", command.name());
      WebDriverLikeRequest request = new WebDriverLikeRequest("POST", p, payload);
      //driver.execute(request);
    } catch (Exception e) {
      log.log(Level.SEVERE, "Configure failed.", e);
    }
View Full Code Here

    // This is to persist the implicit wait timeout after switching to webview and back.
    if (SetImplicitWaitTimeoutNHandler.TIMEOUT != null) {
      // mocking a request to SET_TIMEOUT
      JSONObject payload = new JSONObject();
      payload.append("ms", SetImplicitWaitTimeoutNHandler.TIMEOUT);
      WebDriverLikeRequest
          wdlr =
          new WebDriverLikeRequest("POST", new Path(WebDriverLikeCommand.SET_TIMEOUT), payload);

      // set the timeout by 'handling' the request, we don't care about it's response.
      try {
        CommandMapping.SET_TIMEOUT.createHandler(getServer(), wdlr).handle();
      } catch (Exception e) {
View Full Code Here

      }

      for (String key : extraParamInPath.keySet()) {
        p.validateAndReplace(":" + key, extraParamInPath.get(key));
      }
      WebDriverLikeRequest request = new WebDriverLikeRequest(method, p, builder.build());
      return request;
    }
View Full Code Here

      p.withReference(element.getReference());
    }
    for (String key : extraParamInPath.keySet()) {
      p.validateAndReplace(":" + key, extraParamInPath.get(key));
    }
    WebDriverLikeRequest request = new WebDriverLikeRequest(method, p, params);
    return request;
  }
View Full Code Here

      log.log(Level.WARNING,"error processing request",e);
    }
  }

  private void process(HttpServletRequest request, HttpServletResponse response) throws Exception {
    WebDriverLikeRequest req = new WebDriverLikeRequest(request);

    response.setContentType("application/json;charset=UTF-8");
    response.setCharacterEncoding("UTF-8");

    try {
      response.setStatus(200);
      Response resp = getResponse(req);

      // TODO implement the json protocol properly.
      if (req.getGenericCommand() == WebDriverLikeCommand.NEW_SESSION && resp.getStatus() == 0) {
        response.setStatus(301);
        String session = resp.getSessionId();

        if (session == null || session.isEmpty()) {
          response.setStatus(500);
        }

        String scheme = request.getScheme(); // http
        String serverName = request.getServerName(); // hostname.com
        int serverPort = request.getServerPort(); // 80
        String contextPath = request.getContextPath(); // /mywebapp

        // Reconstruct original requesting URL
        String url = scheme + "://" + serverName + ":" + serverPort + contextPath;
        response.setHeader("location", url + "/session/" + session);
      }

      BeanToJsonConverter converter = new BeanToJsonConverter();
      String s = converter.convert(resp);

      // status is also used for debugging, it's worth formatting it nice.
      if (req.getGenericCommand() == WebDriverLikeCommand.STATUS) {
        JSONObject o = new JSONObject(s);
        response.getWriter().print(o.toString(2));
      } else {
        response.getWriter().print(s);
      }
View Full Code Here

TOP

Related Classes of org.uiautomation.ios.communication.WebDriverLikeRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.