Examples of RemoteWebElement


Examples of org.openqa.selenium.remote.RemoteWebElement

      }
      try {
        Class<?> clazz = Class.forName(remoteObjectName);
        Constructor<?> c = clazz.getConstructor(argsClass);
        Object o = c.newInstance(args);
        RemoteWebElement element = (RemoteWebElement) o;
        element.setFileDetector(driver.getFileDetector());
        element.setParent(driver);
        element.setId(ref);
        return (RemoteIOSObject) o;
      } catch (Exception e) {
        throw new WebDriverException("error casting", e);
      }
    } else {
      RemoteWebElement element = new RemoteWebElement();
      element.setFileDetector(driver.getFileDetector());
      element.setId(ref);
      element.setParent(driver);
      return element;
    }


  }
View Full Code Here

Examples of org.openqa.selenium.remote.RemoteWebElement

    }
  }

  @Test
  public void testElementId() throws Exception {
    RemoteWebElement contain = (RemoteWebElement) driver.findElement(By.id("content"));
    WebElement el = contain.findElementById("local");
    assertEquals(el.getText(), "accumsan ante");

  }
View Full Code Here

Examples of org.openqa.selenium.remote.RemoteWebElement

    }

    if (result instanceof Map<?, ?>) {
      Map<?, ?> resultAsMap = (Map<?, ?>) result;
      if (resultAsMap.containsKey("ELEMENT")) {
        RemoteWebElement element = newRemoteWebElement();
        element.setId(String.valueOf(resultAsMap.get("ELEMENT")));
        return element;
      } else {
        return Maps.transformValues(resultAsMap, this);
      }
    }
View Full Code Here

Examples of org.openqa.selenium.remote.RemoteWebElement

    return result;
  }
 
  protected RemoteWebElement newRemoteWebElement() {
    RemoteWebElement toReturn;
    if (driver.getCapabilities().isJavascriptEnabled()) {
      toReturn = new RenderedRemoteWebElement();
    } else {
      toReturn = new RemoteWebElement();
    }
    toReturn.setParent(driver);
    return toReturn;
  }
View Full Code Here

Examples of org.openqa.selenium.remote.RemoteWebElement

        // are also instances of RemoteWebElement class. The only way that we found at the current moment to find out
        // whether WebElement instance is on remote driver is to check the class of RemoteWebElement "parent" filed,
        // which contains WebDriver instance to which this RemoteWebElement belongs.
        // As this field has protected access this is done by reflection.
        // TODO It's is a kind of a dirty hack to be improved in future versions.
        RemoteWebElement remoteWebElement = (RemoteWebElement) element;
        try {
            Field elementParentFiled = RemoteWebElement.class.getDeclaredField("parent");
            elementParentFiled.setAccessible(true);
            WebDriver elementParent = (WebDriver) elementParentFiled.get(remoteWebElement);
            return elementParent.getClass().equals(RemoteWebDriver.class);
View Full Code Here

Examples of org.openqa.selenium.remote.RemoteWebElement

            this.driver = driver;
        }

        @Override
        protected RemoteWebElement newRemoteWebElement() {
            RemoteWebElement toReturn = new AdaptiveWebElement();
            toReturn.setParent(driver);
            return toReturn;
        }
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

  public Response handle() throws Exception {
    waitForPageToLoad();

    int implicitWait = (Integer) getConf("implicit_wait", 0);
    long deadline = System.currentTimeMillis() + implicitWait;
    RemoteWebElement rwe = null;
    do {
      try {
        rwe = findElement();
        break;
      } catch (InvalidSelectorException e) {
        // no recovery here.
        throw e;
      } catch (NoSuchElementException e) {
        //ignore and try again.
      } catch (RemoteExceptionException e2) {
        // looking on the root element, but document became invalid.
        // Something (alert during onload ) might have prevented the page
        // refresh.
        if (!getRequest().hasVariable(":reference")) {
          getWebDriver().getContext().newContext();
        }

      }
    } while (System.currentTimeMillis() < deadline);

    if (rwe == null) {
      throw new NoSuchElementException(
          "No element found for " + getRequest().getPayload() + " after waiting for " + implicitWait
          + " ms.");
    } else {
      JSONObject res = new JSONObject();
      res.put("ELEMENT", rwe.getReference());
      Response resp = new Response();
      resp.setSessionId(getSession().getSessionId());
      resp.setStatus(0);
      resp.setValue(res);
      return resp;
View Full Code Here

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

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

    RemoteWebElement element = null;

    if (getRequest().hasVariable(":reference")) {
      String reference = getRequest().getVariableValue(":reference");
      element = getWebDriver().createElement(reference);
    } else {
      element = getWebDriver().getDocument();
    }
    RemoteWebElement rwe;
    if ("link text".equals(type)) {
      rwe = element.findElementByLinkText(value, false);
    } else if ("partial link text".equals(type)) {
      rwe = element.findElementByLinkText(value, true);
    } else if ("xpath".equals(type)) {
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 isDisplayed = element.isDisplayed();
    Response res = new Response();
    res.setSessionId(getSession().getSessionId());
    res.setStatus(0);
    res.setValue(isDisplayed);
    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.