Package org.uiautomation.ios.UIAModels.predicate

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


  @Test(expectedExceptions = StaleElementReferenceException.class, enabled = false)
  public void staleElement() {
    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(
              new AndCriteria(new NameCriteria("Back"), new TypeCriteria(UIAButton.class)));
      but.tap();
    }
  }
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);
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 NameCriteria nameCriteria(String serverKey) {
    return nameCriteria(serverKey, MatchingStrategy.exact);
  }

  public NameCriteria nameCriteria(String serverKey, MatchingStrategy matchingStrategy) {
    NameCriteria criteria = new NameCriteria(serverKey, L10NStrategy.serverL10N, matchingStrategy);
    criteria.addDecorator(decorator);
    criteria.decorate();
    return criteria;
  }
View Full Code Here

    Assert.assertEquals(name.getMatchingStrategy(), c.getMatchingStrategy());
  }
 
  @Test
  public void name() throws Exception {
    NameCriteria name = new NameCriteria("the name");
    JSONObject o = name.stringify();

    NameCriteria c = AbstractCriteria.parse(o);

    Assert.assertEquals(name.getClass(), c.getClass());
    Assert.assertEquals(name.getValue(), c.getValue());
    Assert.assertEquals(name.getMatchingStrategy(), c.getMatchingStrategy());
  }
View Full Code Here

      } catch (ClassNotFoundException e) {
        throw new InvalidSelectorException(value + " is not a recognized type.");
      }
      //  http://developer.apple.com/library/ios/#documentation/uikit/reference/UIAccessibilityIdentification_Protocol/Introduction/Introduction.html
    } else if ("name".equals(using) || "id".equals(using)) {
      Criteria c = new NameCriteria(getAUT().applyL10N(value));
      return c.stringify();
    } else if ("link text".equals(using) || "partial link text".equals(using)) {
      return createGenericCriteria(using, value);
    } else {
      throw new InvalidSelectorException(
          using + "is not a valid selector for the native part of ios-driver.");
View Full Code Here

      }
      strategy = MatchingStrategy.regex;
    }

    if ("name".equals(prop)) {
      return new NameCriteria(val, strategy).stringify();
    } else if ("value".equals(prop)) {
      return new ValueCriteria(val, strategy).stringify();
    } else if ("label".equals(prop)) {
      return new LabelCriteria(val, strategy).stringify();
    } else {
View Full Code Here

            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");
View Full Code Here

    driver = new RemoteIOSDriver(getRemoteURL(), SampleApps.intlMountainsCap("en"));
  }

  @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");
View Full Code Here

    Assert.assertEquals(result2.getName(), "Mountain 2");
  }

  @Test
  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));
View Full Code Here

TOP

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

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.