Skip to content
This repository was archived by the owner on Dec 26, 2019. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions XCTWebDriverAgentLib/Commands/FBFindElementCommands.m
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ + (NSArray *)elementsUsing:(NSString *)usingText withValue:(NSString *)value und
elements = [self descendantsOfElement:element withClassName:value];
} else if ([usingText isEqualToString:@"xpath"]) {
elements = [self descendantsOfElement:element withXPathQuery:value];
} else if ([usingText isEqualToString:@"predicate string"]) {
elements = [self descendantsOfElement:element withPredicateString:value];
} else if (isSearchByIdentifier) {
elements = [self descendantsOfElement:element withIdentifier:value];
} else {
Expand Down Expand Up @@ -206,6 +208,13 @@ + (void)descendantsOfElement:(XCUIElement *)element withProperty:(NSString *)pro
[results addObjectsFromArray:childElements];
}

#pragma mark - Search by Predicate String
+ (NSArray *)descendantsOfElement:(XCUIElement *)element withPredicateString:(NSString *)predicateString {
XCUIElementQuery *query = [[element descendantsMatchingType:XCUIElementTypeAny] matchingPredicate:[NSPredicate predicateWithFormat:predicateString]];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it will not work with UIAutomation class names? Which we should remove anyway ;).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct

NSArray *childElements = [query allElementsBoundByIndex];
return childElements;
}


#pragma mark - Search by xpath

Expand Down