Пример #1
0
  private void customiseText(RemoteWebDriver driver) {
    List<WebElement> elementList = driver.findElements(By.className("UIATextView"));

    for (WebElement element : elementList) {
      element.click();
      driver.findElement(By.className("UIATextView")).sendKeys("test");
      driver.findElement(By.name("Done")).click();
    }
  }
  protected void doSimpleExplore(BrowserWebDriverContainer rule) {
    RemoteWebDriver driver = setupDriverFromRule(rule);
    driver.get("http://en.wikipedia.org/wiki/Randomness");

    loop:
    for (int i = 0; i < 5; i++) {
      Random random = new Random();
      List<WebElement> webElements = driver.findElements(By.tagName("a"));
      for (WebElement webElement : webElements) {
        if (random.nextInt(10) == 0 && webElement.isDisplayed() && webElement.isEnabled()) {
          webElement.click();
          break loop;
        }
      }
    }
  }
Пример #3
0
  private void customisePage(RemoteWebDriver driver) {

    List<WebElement> cardRegionView = driver.findElements(By.className("UIACollectionView"));
    List<WebElement> cardRegionCell = driver.findElements(By.className("UIACollectionCell"));
    for (WebElement element : cardRegionView) {
      element.click();

      try {
        customiseImages(driver);
        customiseText(driver);

      } catch (Exception e) {

        customiseText(driver);
      }
    }
  }