title: How to check element properties in iOS gui automation?
body: <p>All UI Automation <a href="http://answers.oreilly.com/topic/1646-how-to-use-uiautomation-to-create-iphone-ui-tests/" rel="nofollow">examples</a> I've seen uses standard components whose state can be inspected with the JavaScript API using the <code>value()</code> method. This is a bit limiting. Lets say you want to check the color or alpha value and whatnot.</p>
  
  <p><strong>How can I inspect the properties of a view?</strong></p>
  
  <p>An example: a tap on a certain element should make it "selected". I'd like to perform a tap on it and then verify that isSelected is TRUE.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I found the <a href="http://developer.apple.com/library/ios/DOCUMENTATION/ToolsLanguages/Reference/UIAElementClassReference/UIAElement/UIAElement.html#//apple_ref/doc/uid/TP40009903-CH1-SW52" rel="nofollow">withPredicate()</a> method which should do it in theory, except it seems to only trigger on <code>name</code> properties:</p>
  
  <pre><code>element.withPredicate("isSelected == YES")          // always fails
  element.withPredicate("name matches 'my element'")  // works
  </code></pre>