-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add partial xpath support to ignore identifiers in the axpath #110
base: master
Are you sure you want to change the base?
Conversation
{ | ||
return rootUIElement; | ||
} | ||
calls++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what the calls
variable for?
[matchedChildren addObject:foundElement]; | ||
} | ||
|
||
return matchedChildren; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
matchedChildren.copy
NSMutableArray *matchedChildren = [NSMutableArray array]; | ||
PFUIElement* foundElement = [self findElementRecursively:rootUIElement calls:0]; | ||
|
||
if ([foundElement isNotEqualTo:nil]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cannot we simply use ==
for comparison here?
@@ -1190,6 +1201,107 @@ - (NSArray *)findAllUsingAXPathComponents:(NSArray *)axPathComponents rootUIElem | |||
return @[]; | |||
} | |||
|
|||
-(PFUIElement*) findElementRecursively:(PFUIElement *)rootUIElement calls:(int)calls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it always make sense to mention nullability in method signatures
return matchedChildren; | ||
} | ||
|
||
-(void) setRoleAndPredicatesOfElement:(NSString*) elementToFind |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class seems overloaded with different stuff. Would it be possible to extract lookup-specific stuff into a separate class/category? Even better, add some basic unit tests to it?
|
||
NSArray* predicateArray = parseElement[kNodePredicate][kPredicateOperations]; | ||
|
||
for (int i=0; i < [predicateArray count]; i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cannot we simple iterate over array items (for-in)?
{ | ||
id object = [predicateArray objectAtIndex:i]; | ||
NSString* attributeName = object[kPredicateAttributeName]; | ||
NSString* attributeValue = object[kPredicateAttributeValue]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attributeValue only should be extracted inside of if
block
|
||
for (int i=0; i < [predicateArray count]; i++) | ||
{ | ||
id object = [predicateArray objectAtIndex:i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible to have better name for this variable?
In the desktop application we have, the AXIdentifier part keeps changing and this results in test case failures.
Adding partial xpath support which will ignore the identifiers and will search for the element recursively