.isHittable Property of an XCUIElement giving Exception "UI Testing Failure - No matches found for "
| Originator: | mansi.v | ||
| Number: | rdar://33772300 | Date Originated: | 8/1/2017 |
| Status: | Open | Resolved: | |
| Product: | iOS | Product Version: | |
| Classification: | Reproducible: | yes |
Summary: We have been using .exists property as well as .isHittable property to check visibility of an XCUIElement on the screen of our app. The .exists property returns true even in the case of hidden elements. So I moved on to using .isHittable property in order to check visibility of the XCUIElement. Instead of giving a false boolean result when the element is not on the screen instead the latter returns an exception saying -> "UI Testing Failure - No matches found for " Is .isHittable supposed to return an exception upon not finding the element on the screen? Steps to Reproduce: Execute the UI test named testExample in the attached project. There are two assert statements in the test. Execute the test and note down the test result. Comment out the first assert statement. Execute the test again and note down the test result for second execution. Expected Results: Both .exists and .isHittable property should deliver the same behaviour of test assert failure. Observed Results: During the second execution of test result, we are actually checking the .isHittable property. The element on which we are checking .exists and .isHittable does not exist in the element hierarchy. On asserting .exists property, a test failure is recorded whereas on asserting .isHittable and exception are thrown about "the element not found". Version: iOS 10.3
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!