Reputation: 1371
My XCode recorded UI test fails on the second line:
XCUIElement *musicselectviewNavigationBar = app.navigationBars[@"MusicSelectView"];
[[musicselectviewNavigationBar.otherElements childrenMatchingType:XCUIElementTypeSearchField].element tap];
[[musicselectviewNavigationBar.searchFields containingType:XCUIElementTypeButton identifier:@"Clear text"].element typeText:@"Lean"];
Upon testing I get this error:
UI Testing failure - No matches found for "MusicSelectView" NavigationBar
Ideas?
Upvotes: 1
Views: 3876
Reputation: 1336
app.navigationBars
matchingIdentifier:@"MusicSelectView"
method callUpvotes: 0
Reputation: 17008
Access the search bar directly instead of using the recorded path.
[app.searchFields[@"Clear text"] tap];
[app.searchFields[@"Clear text"] typeText:@"Lean"];
If there is only one search field present, you can access it with element
.
[[app.searchFields element] tap];
[[app.searchFields element] typeText:@"Lean"];
Upvotes: 2