Skip to content
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

fix: Fixed Xpath lookup for Xcode 14.3 #681

Merged
merged 4 commits into from
Apr 4, 2023
Merged

fix: Fixed Xpath lookup for Xcode 14.3 #681

merged 4 commits into from
Apr 4, 2023

Conversation

Dan-Maor
Copy link
Collaborator

@Dan-Maor Dan-Maor commented Apr 4, 2023

appium/appium#18444

With Xcode 14.3 Apple introduced a new predicate validation class called XCTElementQueryTransformerPredicateValidator which implements the NSPredicateVisitor protocol, used to validate that the predicate components comply with the expected properties in this context.

As part of the query execution the class function +[XCTElementQueryTransformerPredicateValidator validatePredicate:withExpressionsAllowed:] is called to validate the predicate, and since fb_uid is not an expected property of XCElementSnapshot the validation fails and an NSException is thrown.

I tried to find a way to add fb_uid as an acceptable property of the validator, however it appears that the list is defined statically and not as an accessible objective-c object, so it can’t be influenced, and in addition the validation call uses the number of expected objects statically.

Screenshot 2023-04-04 at 17 55 38

By swizzling the function and replacing it with a function which doesn’t do anything I managed to get Xpath lookup to work once more.

Copy link
Member

@KazuCocoa KazuCocoa left a comment

Choose a reason for hiding this comment

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

lgtm

@mykola-mokhnach
Copy link

By swizzling the function and replacing it with a function which doesn’t do anything I managed to get Xpath lookup to work once more.

That's the way I like it :)

@mykola-mokhnach mykola-mokhnach merged commit 3e0b191 into master Apr 4, 2023
@mykola-mokhnach mykola-mokhnach deleted the xcode_143 branch April 4, 2023 19:57
github-actions bot pushed a commit that referenced this pull request Apr 4, 2023
## [4.13.1](v4.13.0...v4.13.1) (2023-04-04)

### Bug Fixes

* Fixed Xpath lookup for Xcode 14.3 ([#681](#681)) ([3e0b191](3e0b191))
@github-actions
Copy link

github-actions bot commented Apr 4, 2023

🎉 This PR is included in version 4.13.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants