-
Notifications
You must be signed in to change notification settings - Fork 416
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
base: master
Are you sure you want to change the base?
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)
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