Package org.uiautomation.ios.wkrdp.model

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


  @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

  // 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

      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

  }

  @Override
  public Response handle() throws Exception {
    String ref = getRequest().getVariableValue(":reference");
    RemoteWebElement element = getWebDriver().createElement(ref);

    JSONArray array = getRequest().getPayload().getJSONArray("value");
    if (log.isLoggable(Level.FINE)) {
      log.fine("payload : " + getRequest().getPayload().toString(2));
    }
    String value = "";

    for (int i = 0; i < array.length(); i++) {
      value += array.get(i);
    }

    boolean useNativeEvents = (Boolean) getConfiguration("nativeEvents");

    if (getNativeDriver().getInstruments() instanceof NoInstrumentsImplementationAvailable) {
      useNativeEvents = false;
    }

    if (useNativeEvents && (element instanceof RemoteWebNativeBackedElement)) {
      ((RemoteWebNativeBackedElement) element).setValueNative(value);
    } else {
      element.setValueAtoms(value);
    }

    Response res = new Response();
    res.setSessionId(getSession().getSessionId());
    res.setStatus(0);
View Full Code Here

    Object p = getRequest().getPayload().get("id");

    if (JSONObject.NULL.equals(p)) {
      getWebDriver().getContext().setCurrentFrame(null, null, null);
    } else {
      RemoteWebElement iframe;
      if (p instanceof String) {
        iframe = getIframe((String) p);
      } else if (p instanceof Integer) {
        iframe = getIframe((Integer) p);
      } else if (p instanceof JSONObject) {
        String id = ((JSONObject) p).getString("ELEMENT");
        iframe = getWebDriver().createElement(id);
      } else {
        throw new UnsupportedCommandException("not supported : frame selection by " + p.getClass());
      }

      RemoteWebElement document = iframe.getContentDocument();
      RemoteWebElement window = iframe.getContentWindow();
      getWebDriver().getContext().setCurrentFrame(iframe, document, window);
    }

    Response res = new Response();
    res.setSessionId(getSession().getSessionId());
View Full Code Here

          "detected " + iframes.size() + " frames. Cannot get index = " + index);
    }
  }

  private RemoteWebElement getIframe(String id) throws Exception {
    RemoteWebElement currentDocument = getWebDriver().getDocument();

    String
        selector =
        "iframe[name='" + id + "'],iframe[id='" + id + "'],frame[name='" + id + "'],frame[id='" + id
        + "']";
    try {
      RemoteWebElement frame = currentDocument.findElementByCSSSelector(selector);
      return frame;
    } catch (NoSuchElementException e) {
      throw new NoSuchFrameException(e.getMessage(), e);
    }
View Full Code Here

  private List<RemoteWebElement> findElements() throws Exception {
    JSONObject payload = getRequest().getPayload();
    String type = payload.getString("using");
    String value = payload.getString("value");

    RemoteWebElement element = null;

    if (getRequest().hasVariable(":reference")) {
      String ref = getRequest().getVariableValue(":reference");
      element = getWebDriver().createElement(ref);
    } else {
      element = getWebDriver().getDocument();
    }

    List<RemoteWebElement> res;
    if ("link text".equals(type)) {
      res = element.findElementsByLinkText(value, false);
    } else if ("partial link text".equals(type)) {
      res = element.findElementsByLinkText(value, true);
    } else if ("xpath".equals(type)) {
      res = element.findElementsByXpath(value);
    } else {
      String cssSelector = ToCSSSelectorConverter.convertToCSSSelector(type, value);
      res = element.findElementsByCSSSelector(cssSelector);
    }
    return res;
  }
View Full Code Here

  }

  @Override
  public Response handle() throws Exception {
    String reference = getRequest().getVariableValue(":reference");
    RemoteWebElement element = getWebDriver().createElement(reference);

    boolean useNativeEvents = (Boolean) getConfiguration("nativeEvents");

    if (getNativeDriver().getInstruments() instanceof NoInstrumentsImplementationAvailable) {
      useNativeEvents = false;
    }

    if (useNativeEvents && (element instanceof RemoteWebNativeBackedElement)) {
      ((RemoteWebNativeBackedElement) element).nativeClick();
      // native tapping in a webview delays triggering the event for 300ms (because iOS is looking to see if it's a gesture)
      // going to assume if you have implicit waits set you want this delay, if not you want it to return 'fast'
      if (getSession().getDualDriver().getWorkingMode() == WorkingMode.Web &&
          SetImplicitWaitTimeoutNHandler.TIMEOUT != null &&
          SetImplicitWaitTimeoutNHandler.TIMEOUT > 0) {
        Thread.sleep(300);
      }
    } else {
      element.click();
    }

    Response resp = new Response();
    resp.setSessionId(getSession().getSessionId());
    resp.setStatus(0);
View Full Code Here

  }

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

TOP

Related Classes of org.uiautomation.ios.wkrdp.model.RemoteWebElement

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.