Examples of RemoteWebElement


Examples of org.uiautomation.ios.wkrdp.model.RemoteWebElement


  private RemoteWebElement retrieveDocument() throws Exception {
    JSONObject result = sendCommand(DOM.getDocument());
    JSONObject root = result.getJSONObject("root");
    RemoteWebElement rme = new RemoteWebElement(new NodeId(root.getInt("nodeId")), this);
    return rme;
  }
View Full Code Here

Examples of org.uiautomation.ios.wkrdp.model.RemoteWebElement

  }

  private String getCurrentUrlOnce() {

    try {
      RemoteWebElement document = getDocument();
      String f = "(function(arg) { var url=this.URL;return url;})";
      JSONObject cmd = new JSONObject();

      cmd.put("method", "Runtime.callFunctionOn");

      JSONArray args = new JSONArray();

      cmd.put("params", new JSONObject().put("objectId", document.getRemoteObject().getId())
          .put("functionDeclaration", f).put("arguments", args).put("returnByValue", true));

      JSONObject response = sendCommand(cmd);
      return cast(response);
    } catch (JSONException e) {
View Full Code Here

Examples of org.uiautomation.ios.wkrdp.model.RemoteWebElement

  public JSONObject getScriptResponse(String script) throws JSONException {
    return getScriptResponse(script, new JSONArray());
  }

  public JSONObject getScriptResponse(String script, JSONArray arguments) throws JSONException {
    RemoteWebElement document = getDocument();

    if (!context.isOnMainFrame()) {
      arguments.put(new JSONObject().put("objectId", document.getRemoteObject().getId()));
      arguments.put(new JSONObject().put("objectId", context.getWindow().getRemoteObject().getId()));

      String contextObject = "{'document': arguments[" + (arguments.length() - 2) + "], 'window': arguments[" + (arguments.length() - 1) + "]}";
      script = "with (" + contextObject + ") {" + script + "}";

    }

    JSONObject cmd = new JSONObject();
    cmd.put("method", "Runtime.callFunctionOn");
    cmd.put(
        "params",
        new JSONObject().put("objectId", document.getRemoteObject().getId())
            .put("functionDeclaration", "(function() { " + script + "})")
            .put("arguments", arguments)
            .put("returnByValue", false));
    JSONObject response = sendCommand(cmd);
    checkForJSErrors(response);
View Full Code Here

Examples of org.uiautomation.ios.wkrdp.model.RemoteWebElement

      if (arg instanceof JSONObject) {
        JSONObject jsonArg = (JSONObject) arg;
        if (jsonArg.optString("ELEMENT") != null) {
          // TODO use driver factory to check the  pageId
          NodeId n = new NodeId(Integer.parseInt(jsonArg.optString("ELEMENT").split("_")[1]));
          RemoteWebElement rwep = new RemoteWebElement(n, this);
          arguments.put(new JSONObject().put("objectId", rwep.getRemoteObject().getId()));
        }
      } else if (arg instanceof JSONArray) {
        JSONArray jsonArr = (JSONArray) arg;
        JSONObject array = getScriptResponse("return " + jsonArr.toString() + ";");
View Full Code Here

Examples of org.uiautomation.ios.wkrdp.model.RemoteWebElement

    return dim;

  }

  public RemoteWebElement findElementByCSSSelector(String cssSelector) {
    RemoteWebElement document = getDocument();
    return document.findElementByCSSSelector(cssSelector);
  }
View Full Code Here

Examples of org.uiautomation.ios.wkrdp.model.RemoteWebElement

    RemoteWebElement document = getDocument();
    return document.findElementByCSSSelector(cssSelector);
  }

  public List<RemoteWebElement> findElementsByCSSSelector(String cssSelector) {
    RemoteWebElement document = getDocument();
    return document.findElementsByCSSSelector(cssSelector);
  }
View Full Code Here

Examples of org.uiautomation.ios.wkrdp.model.RemoteWebElement

    resp.setSessionId(getSession().getSessionId());
    resp.setStatus(0);

    if (res instanceof RemoteObject) {
      RemoteObject ro = (RemoteObject) res;
      RemoteWebElement rwe = ro.getWebElement();
      JSONObject jo = new JSONObject().put("ELEMENT", rwe.getReference());
      resp.setValue(jo);
    } else if (res instanceof Integer) {
      resp.setValue(res);
    } else if (res instanceof Boolean) {
      resp.setValue(res);
View Full Code Here

Examples of org.uiautomation.ios.wkrdp.model.RemoteWebElement

  @Override
  public Response handle() throws Exception {
    String attributeName = getRequest().getVariableValue(":name");
    String ref = getRequest().getVariableValue(":reference");
    RemoteWebElement element = getWebDriver().createElement(ref);
    Object value = element.getAttribute(attributeName);
    Response res = new Response();
    res.setSessionId(getSession().getSessionId());
    res.setStatus(0);
    res.setValue(value);
    return res;
View Full Code Here

Examples of org.uiautomation.ios.wkrdp.model.RemoteWebElement

  // TODO freynaud reset() != pageLoad
  public void reset() {
    if (log.isLoggable(Level.FINE))
      log.fine("reset called on " + toString());
    RemoteWebElement newDocument = null;
    RemoteWebElement newWindow = null;

    // check is what changed was the context for the current frame.
    if (iframe != null) {
      log.info("iframe was null");
      try {
View Full Code Here

Examples of org.uiautomation.ios.wkrdp.model.RemoteWebElement

      log.log(Level.SEVERE,"",e);
    }
  }

  private void assignNewFrameFromEvent(ChildIframeInserted newFrameEvent) throws Exception {
    RemoteWebElement frame = new RemoteWebElement(newFrameEvent.getNode(), inspector);
    RemoteWebElement document = new RemoteWebElement(newFrameEvent.getContentDocument(), inspector);
    RemoteWebElement window = frame.getContentWindow();
    setCurrentFrame(frame, document, window);
    isReady = true;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.