Package org.uiautomation.ios.UIAModels

Examples of org.uiautomation.ios.UIAModels.UIAElement


    Assert.assertTrue(tree.has("tree"));
  }

  @Test
  public void logElementTreeWithScreenshot() throws Exception {
    UIAElement element = driver.findElement(c);
    File f = new File("logElementTreeWithScreenshotTmp");
    f.delete();
    JSONObject tree = element.logElementTree(f, true);
    Assert.assertTrue(tree.has("tree"));
    Assert.assertTrue(f.exists());
    f.delete();
  }
View Full Code Here


    try {
      String name = "Buttons, Various uses of UIButton";
      Criteria c1 = new TypeCriteria(UIATableCell.class);
      Criteria c2 = new NameCriteria(name);
      Criteria c = new AndCriteria(c1, c2);
      UIAElement element = driver.findElement(c);
      // should work.
      // new screen. The element doesn't exist anymore
      element.tap();

      // that doesn't throw. The element isn't visible, but it's still accessible with UIAutomation.
      String s = element.getName();
      Assert.fail("cannot access stale elements");
    } finally {
      UIAButton
          but =
          driver.findElement(
View Full Code Here

  private UIATextView getTextView() {
    String name = "TextView, Use 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 TypeCriteria(UIATextView.class);
    UIATextView res = (UIATextView) driver.findElement(fieldC);
    return res;
  }
View Full Code Here

  private void typeURLNative(String url) {
    getSession().getDualDriver().setMode(WorkingMode.Native);
    getAddressBar().click();
    RemoteUIAKeyboard keyboard = (RemoteUIAKeyboard) getNativeDriver().getKeyboard();
    keyboard.sendKeys(url);
    UIAElement go = keyboard.findElement(new NameCriteria("Go"));
    go.tap();
    getSession().getDualDriver().setMode(WorkingMode.Web);

  }
View Full Code Here

  public void logElement() throws Exception {
    driver =
        new RemoteIOSDriver(getRemoteURL(),
            SampleApps.intlMountainsCap(Locale.FRENCH.toString()));
    Criteria c1 = new TypeCriteria(UIATableCell.class);
    UIAElement element = driver.findElement(c1);
    element.tap();

    NameCriteria criteria =
        new NameCriteria("sentenceFormat", L10NStrategy.serverL10N, MatchingStrategy.regex);
    UIAElement el = driver.findElement(criteria);
    JSONObject log = el.logElementTree(null, true);
    Orientation o = Orientation.fromInterfaceOrientation(log.getInt("deviceOrientation"));
    Assert.assertEquals(o, Orientation.PORTRAIT);
    JSONObject tree = log.getJSONObject("tree");

    Assert.assertEquals(tree.getString("type"), "UIAStaticText");
View Full Code Here

  @Test
  public void orCriteriaReturnsFirstMatch() {
    Criteria mountain1 = new NameCriteria("Mountain 1");
    Criteria mountain2 = new NameCriteria("Mountain 2");

    UIAElement result1 = driver.findElement(new OrCriteria(mountain1, mountain2));
    UIAElement result2 = driver.findElement(new OrCriteria(mountain2, mountain1));

    Assert.assertEquals(result1.getName(), "Mountain 1");
    Assert.assertEquals(result2.getName(), "Mountain 2");
  }
View Full Code Here

  public void complexOrCriteriaReturnsFirstMatch() {
    Criteria mountain1 = new NameCriteria("Mountain 1");
    Criteria mountain2 = new NameCriteria("Mountain 2");
    Criteria mountain3 = new NameCriteria("Mountain 3");

    UIAElement result1 = driver.findElement(new OrCriteria(mountain1, mountain2, mountain3));
    UIAElement
        result3 =
        driver.findElement(new OrCriteria(new OrCriteria(mountain3, mountain2), mountain1));

    Assert.assertEquals(result1.getName(), "Mountain 1");
    Assert.assertEquals(result3.getName(), "Mountain 3");
  }
View Full Code Here

  @Test(dataProvider = "intlMountain")
  public void selectAndValidateServerSideL10NedContent(String lang, String expectedContent) {
    driver = new RemoteIOSDriver(getRemoteURL(), SampleApps.intlMountainsCap(lang));

    Criteria c1 = new TypeCriteria(UIATableCell.class);
    UIAElement element = driver.findElement(c1);
    element.tap();

    NameCriteria
      criteria =
      new NameCriteria("sentenceFormat", L10NStrategy.serverL10N, MatchingStrategy.regex);
    UIAElement text = driver.findElement(criteria);
    String actual = text.getName();
    Assert.assertEquals(actual, expectedContent);

    criteria =
      new NameCriteria("meterFormat", L10NStrategy.serverL10N, MatchingStrategy.contains);
    text = driver.findElement(criteria);
    actual = text.getName();
    Assert.assertEquals(actual, expectedContent);

    // and using Xpath
    WebElement el = driver.findElement(By.xpath("//*[matches(@name,l10n('meterFormat'))]"));

 
View Full Code Here

  @Test
  public void apostrophe() {
    driver = new RemoteIOSDriver(getRemoteURL(), SampleApps.intlMountainsCap("fr"));

    Criteria c1 = new TypeCriteria(UIATableCell.class);
    UIAElement element = driver.findElement(c1);
    element.tap();

    // and using Xpath
    WebElement
      el =
      driver.findElement(By.xpath("//*[matches(@name,l10n('detailViewNavTitle'))]"));
 
View Full Code Here

  @BeforeClass
  public void startDriver() {
    driver = new RemoteIOSDriver(getRemoteURL(), SampleApps.intlMountainsCap("fr"));
    Criteria c1 = new TypeCriteria(UIATableCell.class);
    UIAElement element = driver.findElement(c1);
    element.tap();
  }
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.