Examples of RemoteWebElement


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

  }

  @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

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

    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

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

          "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

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

  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

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

  }

  @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

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

  }

  @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

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

  }

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

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

                                               + "window with focus has changed.");
    }
    if (session != null) {
      return new RemoteWebNativeBackedElement(new NodeId(nodeId), currentInspector, session);
    } else {
      return new RemoteWebElement(new NodeId(nodeId), currentInspector);
    }
  }
View Full Code Here

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

  }

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

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

  }

  @Override
  public Response handle() throws Exception {
    String ref = getRequest().getVariableValue(":reference");
    RemoteWebElement element = getWebDriver().createElement(ref);
    String value = element.getTagName();
    Response res = new Response();
    res.setSessionId(getSession().getSessionId());
    res.setStatus(0);
    res.setValue(value);
    return res;
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.