Skip to content

Commit

Permalink
fix: Update keyboard lookup logic (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach authored Jan 25, 2021
1 parent b14aaab commit 54c73ff
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions WebDriverAgentLib/Utilities/FBKeyboard.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ + (BOOL)waitUntilVisibleForApplication:(XCUIApplication *)app timeout:(NSTimeInt
return NO;
}

NSPredicate *keySearchPredicate = [NSPredicate predicateWithFormat:@"label.length > 0"];
XCUIElement *firstKey = [app.keyboard.keys matchingPredicate:keySearchPredicate].firstMatch;
NSPredicate *keySearchPredicate = [NSPredicate predicateWithBlock:^BOOL(XCElementSnapshot *snapshot,
NSDictionary *bindings) {
return snapshot.label.length > 0;
}];
XCUIElement *firstKey = [[app.keyboard descendantsMatchingType:XCUIElementTypeKey]
matchingPredicate:keySearchPredicate].allElementsBoundByIndex.firstObject;
return firstKey.exists
&& (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"13.0") ? firstKey.hittable : firstKey.fb_isVisible);
};
Expand Down

0 comments on commit 54c73ff

Please sign in to comment.