Package org.openqa.selenium.remote

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


    }
  }

  @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

    }

    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

    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

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

            this.driver = driver;
        }

        @Override
        protected RemoteWebElement newRemoteWebElement() {
            RemoteWebElement toReturn = new AdaptiveWebElement();
            toReturn.setParent(driver);
            return toReturn;
        }
View Full Code Here

TOP

Related Classes of org.openqa.selenium.remote.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.