Package org.openqa.selenium.remote

Examples of org.openqa.selenium.remote.BeanToJsonConverter


      JSONArray supportedApps = new JSONArray();

      List<IOSCapabilities> caps = mgr.getAllCapabilities();
      for (IOSCapabilities cap : caps) {
        try {
          String json = new BeanToJsonConverter().convert(cap);
          JSONObject app = new JSONObject(json);
          app.put("resources", getAppResources(app));
          supportedApps.put(app);
        } catch (JSONException e) {
          log.log(Level.SEVERE, "format error", e);
View Full Code Here


    if ("stop".equals(request.getScript())) {
      Response response = new Response();
      response.setSessionId(getSessionId());
      response.setStatus(0);
      response.setValue(STOP_RESPONSE);
      BeanToJsonConverter converter = new BeanToJsonConverter();
      String json = converter.convert(response);
      UIAScriptResponse r = new UIAScriptResponse(json);
      setNextResponse(r);
    }
  }
View Full Code Here

        if (session.getStopCause() != null) {
          r.setValue(session.getStopCause().name());
        } else {
          r.setValue(UNKNOWN_REASON);
        }
        UIAScriptResponse response = new UIAScriptResponse(new BeanToJsonConverter().convert(r));
        return response;
      }

      // we have a "valid" response
      if (res != null) {
View Full Code Here

    if (o instanceof Map) {
      Map<String, Object> map = (Map<String, Object>) o;
      if (map.containsKey("ELEMENT")) {
        return (T) RemoteIOSObject.createObject(driver, map);
      } else if (map.containsKey("tree")) {
        String serialized = new BeanToJsonConverter().convert(o);
        try {
          return (T) new JSONObject(serialized);
        } catch (JSONException e) {
          throw new WebDriverException("cannot cast");
        }
View Full Code Here

        title += "(Simulator)";
      }

      b.append("<h3>" + title + "</h3>");
      try {
        String json = new BeanToJsonConverter().convert(cap);
        JSONObject o = new JSONObject(json);
        b.append(o.toString(2));
      } catch (JSONException e) {
        log.log(Level.SEVERE,"format error",e);
      }
View Full Code Here

        // 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));
View Full Code Here

    super(null, null);
    this.version = version;
    this.bundleId = bundleId;
    this.info = info;
    try {
      this.metadata = new JSONObject(new BeanToJsonConverter().convert(getCapabilities()));
    } catch (JSONException e) {
     log.log(Level.SEVERE,"shell ipa metadata error",e);
    }
  }
View Full Code Here

  public void render(HttpServletRequest request, HttpServletResponse response, Handler handler)
      throws Exception {
    Object result = request.getAttribute(propertyName);

    String json = new BeanToJsonConverter().convert(result);
    byte[] data = Charset.forName("utf-8").encode(json).array();

    int length = json == null ? 0 : data.length;

    response.setContentLength(length);
View Full Code Here

    Exception e = (Exception) request.getAttribute(exceptionName);

    Response res = new Response();
    res.setError(true);

    String raw = new BeanToJsonConverter().convert(e);
    JSONObject error = new JSONObject(raw);
    if (raw.startsWith("{")) {
      error.put("screen", request.getAttribute("screen"));
    }
    res.setValue(error.toString());
View Full Code Here

TOP

Related Classes of org.openqa.selenium.remote.BeanToJsonConverter

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.