-
Notifications
You must be signed in to change notification settings - Fork 426
feat: Add a real frame property of the element #1017
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
feat: Add a real frame property of the element #1017
Conversation
@mykola-mokhnach Please take a look, when you have time. |
// | ||
// Use `wdRealFrameString` to obtain this value in a simplified string | ||
// format, avoiding excessively long numeric values in the JSON output. | ||
double factor = pow(10, 2); |
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.
I'm not sure if this conversation is really necessary. It's probably ok if we want to reduce json string size, but not ok if we just want to fetch the original native attribute value as is via the /attribute API
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.
Agree. It makes sense for me to return the original one as-is for the original motivation (to return actual value as possible in terms of pixel perfect)
21e78e4
to
06d7446
Compare
Thank you @mykola-mokhnach and @KazuCocoa for your notes |
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.
lgtm (running/re-running ci)
@anton-yereshchenko I have just merged #1016 to master Please resolve conflicts and then we'd be ready to merge your PR |
06d7446
to
9cf76dc
Compare
@mykola-mokhnach I have resolved conflicts. |
@anton-yereshchenko please do not forget to update xcuitest documentation after this PR is merged and published. |
## [9.8.0](v9.7.1...v9.8.0) (2025-05-21) ### Features * Add a native frame property of the element ([#1017](#1017)) ([09214c4](09214c4))
🎉 This PR is included in version 9.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hi @anton-yereshchenko, congrats: the Appium project wants to compensate you for this contribution! Please reply to this comment mentioning @jlipps and @KazuCocoa and sharing your OpenCollective account name, so that we can initiate payment! Or let us know if you decline to receive compensation via OpenCollective. Thank you! |
@jlipps @KazuCocoa Wow, Thank you so much! Always happy to help. |
Summary
This pull request introduces support for retrieving the actual rendered frame of a UI element, providing a more precise representation than the standard
wdFrame
value.Motivation
The original
wdFrame
property applies rounding logic, which in some cases may lead to inaccurate element sizes or positions.Example Case: iPhone 16 Pro Simulator
Consider the following scenario:
We have a button, and after launching the app, we retrieve its
frame
using either a UI test or from withinviewDidAppear
.The returned
frame
is:(190.66666666666666, 426.6666666666667, 20.666666666666686, 20.66666666666663)
However, when requesting the same frame from WebDriverAgent (wdFrame), we receive:
(190, 426, 22, 22)
This difference - sometimes exceeding 1 pt and occasionally reaching 2 pt - can lead to inconsistencies, especially when performing 'pixel-perfect' validations.
Proposed Solution
We can round the frame values to two decimal places, resulting in a more accurate and human-readable format:
(190.67, 426.67, 20.67, 20.67)
Could we make some toggle in the configuration? To turn on this property?
Thanks for the idea with
nonPrefixedKeys
.Ref: #1016