-
Notifications
You must be signed in to change notification settings - Fork 105
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
"Get BoundingBox" fails if element is not visible, wo proper error. #3651
Comments
@allcontributors please add @Andre-A-AtGithub for bugs |
I've put up a pull request to add @Andre-A-AtGithub! 🎉 |
I'm assisting Andre with the analysis of this issue and this is my current understanding of what's happening: In the past (when this framework / these keywords were created), This change seems to be (partially?) incompatible with the cascaded locator syntax ( What we see happening now is that where in the past we got something like Note the It really goes off-track when I hope this makes sense, it's hard to provide an example showing the issue, especially since such a sample would require different Playwright / Browser versions. If the problem is clear, would there be any suggestions how we could repair the framework? Note there's quite a bit of use of the |
@Snooz82 I think you did drive this change and I don’t anymore remember why it was done. Could you explain and even better if you have suggestions how to fix it. |
the real origin was that back in the days playwright did actually keep a handle on the real element. similar to Selenium. BUT you may know the problems with Seleniums „Element Stale Exception“ that if that element changes, it may not be accessible. so they changed it so, that the so if you do in playwright Playwright docs:
so when we do |
the |
So this Playwright code: await page.locator('*css=.box >> "ABS"').locator('input')._selector gives the following selector:
So it will not be the SO: |
And i think the overall problem here is, that you have an element that is not visible and therefore Get Bounding Box does fail with this error. I can without any problems iterate over many elements like this:
As long as all of them are visible. |
Get BoundingBox does fail with weird error:
So If you are ok with it, i would change that issue to fix the keyword. |
If instead of raising an error, it would return I only have access to the codebase if I'm in office with Andre, I'll check the use of |
First of all I really appreciate the effort you all put in this. With the new info I am now able to reproduce this issue fully, I can confirm it is specifically with a element that is hidden. I used this test to reproduce it, it uses a dutch webshop. *** Test Cases *** |
i would not like to return If you call i am fine adding an additional argument that enables „not failing“ but by default i would still Fail with a proper error message. |
I don't think a An empty dict would also work for me and would make the interface consistent. An optional named argument to suppress any errors and return |
playwright states that null is returned if hidden. element not found would be an error that we won’t suppress. if you return an empty dict, users may access the we made these mistakes earlier and i won’t repeat. we either return a valid position and size or fail. |
Looking back at the trace from the log we see that the problem is in The Since Playwright states that
Of course, that would fail on Playwright's side in
I can see that.
What my issue is with that approach is that it's different from Playwright's approach. Playwright returns a dict with the coordinates or Of course "valid value or fail" would be justified if all the keywords in Browser library do check for
if data is None and self.allow_none_result:
return None
parsed = DoctDict(data)
... |
i do agree that this is a regression. before we did anything with the result, it would have worked. we do not have the policy to behave same as Playwright. So no need to return None. in Robot Framework you typically do expect to get always the same. we did for example had keywords where we sometimes returned just a single value and sometimes a list of values, which make the code unnecessarily complex when using the keywords.
|
@robinmackaij Playwright itself is imho not really consistent.
So as i would expect, if that call is not really applicable to the selected element the keyword shall fail. |
Signed-off-by: René <[email protected]>
Signed-off-by: René <[email protected]>
Describe the bug
Using FOR loop to iterate "Elements" "Get BoundingBox" gives error.
This worked before when using "older" versions. After updating to latest version of Python, Robot framework, Browser, etc this issue arose. See below overview of exact "old" and "new" versions:
Python: 3.9 → 3.12
Robotframework: 4.1.1 → 7.0
Robotframework-browser: 8.0.2 → 18.5.1
For more information see Robot framework Slack: https://robotframework.slack.com/archives/C015KB1QSDN/p1717657032495999
Print screen of debug log
To Reproduce
Environment:
This mainly happens in the test auto test framework I use, it is for me not certain if this also occurs in other setups.
Steps to reproduce the behavior:
Relevant code in our test framework:
${elements}= Get Elements ${selector}
FOR ${element} IN @{elements}
${box}= Get BoundingBox ${element}
IF ${box}
Append To List ${bounded_elements} ${element}
END
END
RETURN ${bounded_elements}
Expected behavior
That it iterates all elements that are in the list
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: