Package org.uiautomation.ios.UIAModels.predicate

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


    return new InterfaceImplementation() {

      public Object invoke(ExecuteMethod exec, Object self, Method method, Object... args) {
        RemoteWebDriver driver = (RemoteWebDriver) self;
        WebDriverLikeCommandExecutor executor = new WebDriverLikeCommandExecutor(driver);
        Criteria criteria = (Criteria) args[0];

        if ("findElement".equals(method.getName())) {
          return RemoteIOSDriver.findElement(executor, criteria);

        } else if ("findElements".equals(method.getName())) {
View Full Code Here


  }

  @Override
  public <T extends UIAElement> T findElement(Class<T> type, Criteria c)
      throws NoSuchElementException {
    Criteria newOne = new AndCriteria(new TypeCriteria(type), c);
    return (T) findElement(newOne);
  }
View Full Code Here

  @Test
  public void getElement() throws InterruptedException {
    driver = getDriver(SampleApps.uiCatalogCap());
    String name = "Buttons, Various uses of UIButton2";

    Criteria c1 = new TypeCriteria(UIATableCell.class);
    Criteria c2 = new NameCriteria(name);
    Criteria c = new AndCriteria(c1, c2);
    long start = System.currentTimeMillis();
    try {
      driver.findElement(c);
      Assert.fail("shouldn't find element" + name);
    } catch (NoSuchElementException e) {
View Full Code Here

  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

  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);

    UIARect position = element.getRect();

    //center
    Criteria
        test =
        new LocationCriteria(position.getX() + (position.getWidth() / 2),
                             position.getY() + (position.getHeight() / 2));
    UIAElement res = driver.findElement(test);
    Assert.assertEquals(res.getName(), buttonName);
View Full Code Here

TOP

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

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.