Package org.uiautomation.ios.UIAModels.predicate

Examples of org.uiautomation.ios.UIAModels.predicate.TypeCriteria


  private static final String buttonsName = "Buttons, Various uses of UIButton";

  @Test
  public void findElementByCriteria() throws InterruptedException {
    Criteria c1 = new TypeCriteria(UIATableCell.class);
    Criteria c2 = new NameCriteria(buttonsName);
    Criteria c = new AndCriteria(c1, c2);
    UIAElement element = driver.findElement(c);
    Assert.assertEquals(element.getName(), buttonsName);
  }
View Full Code Here


    Assert.assertEquals(element.getAttribute("name"), buttonsName);
  }

  @Test
  public void findElementsCriteria() throws InterruptedException {
    Criteria cell = new TypeCriteria(UIATableCell.class);
    List<UIAElement> elements = driver.findElements(cell);
    Assert.assertEquals(elements.size(), 12);
  }
View Full Code Here

    Assert.assertEquals(elements.size(), 12);
  }

  @Test(expectedExceptions = NoSuchElementException.class)
  public void findElementNoResult() throws InterruptedException {
    Criteria c1 = new TypeCriteria(UIATableCell.class);
    Criteria c2 = new NameCriteria("I don't exist.");
    Criteria c = new AndCriteria(c1, c2);
    driver.findElement(c);
    Assert.fail("should have thrown");
  }
View Full Code Here

    Assert.fail("should have thrown");
  }

  @Test
  public void findElementsNoResult() throws InterruptedException {
    Criteria c1 = new TypeCriteria(UIATableCell.class);
    Criteria c2 = new NameCriteria("I don't exist.");
    Criteria c = new AndCriteria(c1, c2);
    List<UIAElement> elements = driver.findElements(c);
    Assert.assertEquals(elements.size(), 0);
  }
View Full Code Here

  }

  @Test
  public void findElementsOnElementCriteria() throws InterruptedException {
    UIAApplication app = (UIAApplication) driver.findElement(By.tagName("UIAApplication"));
    List<UIAElement> elements = app.findElements(new TypeCriteria(UIATableCell.class));
    Assert.assertEquals(elements.size(), 12);
  }
View Full Code Here

  private static final String buttonName = "Buttons, Various uses of UIButton";

  @Test
  public void exactMatch() {
    Criteria c1 = new TypeCriteria(UIATableCell.class);
    PropertyEqualCriteria c2 = new NameCriteria(buttonName);
    Assert.assertEquals(c2.getMatchingStrategy(), MatchingStrategy.exact);
    Criteria c = new AndCriteria(c1, c2);
    UIAElement element = driver.findElement(c);
    Assert.assertEquals(element.getName(), buttonName);
View Full Code Here

  }

  @Test
  public void regexMatch() throws InterruptedException {
    String regex = "Buttons, V[a-z]* uses of UIButton";
    Criteria c1 = new TypeCriteria(UIATableCell.class);
    PropertyEqualCriteria c2 = new NameCriteria(regex, MatchingStrategy.regex);
    Criteria c = new AndCriteria(c1, c2);
    UIAElement element = driver.findElement(c);
    Assert.assertEquals(element.getName(), buttonName);
  }
View Full Code Here

    Assert.assertEquals(element.getName(), buttonName);
  }

  @Test
  public void positionMatch() {
    Criteria c1 = new TypeCriteria(UIATableCell.class);
    PropertyEqualCriteria c2 = new NameCriteria(buttonName);
    Assert.assertEquals(c2.getMatchingStrategy(), MatchingStrategy.exact);
    Criteria c = new AndCriteria(c1, c2);
    UIAElement element = driver.findElement(c);
View Full Code Here

    goToAlertScreen();
  }

  private void goToAlertScreen() {
    String name = "Alerts";
    Criteria c1 = new TypeCriteria(UIATableCell.class);
    Criteria c2 = new NameCriteria(name, MatchingStrategy.starts);
    Criteria c = new AndCriteria(c1, c2);
    UIAElement element = driver.findElement(c);
    element.tap();
  }
View Full Code Here

  private UIATextField textfield;

  private UIATextField getTextField() {
    String name = "TextFields, Uses of UITextField";
    Criteria c1 = new TypeCriteria(UIATableCell.class);
    Criteria c2 = new NameCriteria(name);
    Criteria c = new AndCriteria(c1, c2);
    UIAElement element = driver.findElement(c);
    element.tap();
    Criteria
        fieldC =
        new AndCriteria(new TypeCriteria(UIATextField.class), new NameCriteria("Normal"));
    UIATextField textfield = (UIATextField) driver.findElement(fieldC);
    return textfield;
  }
View Full Code Here

TOP

Related Classes of org.uiautomation.ios.UIAModels.predicate.TypeCriteria

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.