Package org.uiautomation.ios.UIAModels

Examples of org.uiautomation.ios.UIAModels.UIAElement


      driver.switchTo().window("Web");
      Assert.fail("shouldn't work");
    } catch (NoSuchWindowException e) {
      // expected
    }
    UIAElement el =
        driver.findElement(
            new AndCriteria(new TypeCriteria(UIATableCell.class), new NameCriteria("Web",
                MatchingStrategy.starts)));
    el.tap();

    while (driver.getWindowHandles().size() != 2) {
      Thread.sleep(50);
    }
    handles = driver.getWindowHandles();
    Assert.assertEquals(handles.size(), 2);

    UIAElement back = driver
        .findElement(
        new AndCriteria(new TypeCriteria(UIAButton.class), new NameCriteria("Back")));
    back.tap();
    long deadline = System.currentTimeMillis() + 5000;
    while (driver.getWindowHandles().size() != 1) {
      Thread.sleep(50);
      if (System.currentTimeMillis() > deadline) {
        break;
View Full Code Here


    safari.setCapability(IOSCapabilities.TIME_HACK, false);

    driver = new RemoteIOSDriver(getRemoteURL(), SampleApps.uiCatalogCap());
    Set<String> handles = driver.getWindowHandles();
    Assert.assertEquals(handles.size(), 1);
    UIAElement webCell =
        driver.findElement(new AndCriteria(new TypeCriteria(UIATableCell.class), new NameCriteria(
            "Web", MatchingStrategy.starts)));
    webCell.tap();

    handles = driver.getWindowHandles();
    Assert.assertEquals(handles.size(), 2);
    driver.switchTo().window("Web");
    // TODO fix that server side. Accessing a webview currently loading isn't handled ?
View Full Code Here

    safari.setCapability(IOSCapabilities.TIME_HACK, false);

    driver = new RemoteIOSDriver(getRemoteURL(), SampleApps.uiCatalogCap());
    Set<String> handles = driver.getWindowHandles();
    Assert.assertEquals(handles.size(), 1);
    UIAElement webCell =
        driver.findElement(new AndCriteria(new TypeCriteria(UIATableCell.class), new NameCriteria(
            "Web", MatchingStrategy.starts)));
    webCell.tap();

    Thread.sleep(5000);
    driver.switchTo().window("Web");
    Thread.sleep(5000);
    driver.get("http://ebay.co.uk");
View Full Code Here

  @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

  }

  @Test
  public void findElementOnElementCriteria() throws InterruptedException {
    UIAApplication app = (UIAApplication) driver.findElement(By.tagName("UIAApplication"));
    UIAElement element = app.findElement(new NameCriteria(buttonsName));
    Assert.assertEquals(element.getName(), buttonsName);
    Assert.assertTrue(element instanceof UIATableCell);
  }
View Full Code Here

  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

  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

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

    // bottom right corner
    int x = position.getX() + position.getWidth() - 1;
    int y = position.getY() + position.getHeight() - 1;
    test = new LocationCriteria(x, y);
    res = driver.findElement(test);
    Assert.assertEquals(res.getName(), buttonName);

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

  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 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.UIAElement

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.