MarketSquare / robotframework-browser

Robot Framework Browser library powered by Playwright.
Apache License 2.0
499 stars 105 forks source link

Using FOR loop to iterate "Elements" "Get BoundingBox" gives error #3651

Open Andre-A-AtGithub opened 1 month ago

Andre-A-AtGithub commented 1 month ago

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 image

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:

  1. Run "Get Elements" in a way it gives more than 1 results
  2. Use FOR loop to iterate the elements to find the boundingbox of the elements
  3. When the list of elements contains more than 1 element in the list than there is a error: TypeError: 'NoneType' object is not iterable". I also added a image of the error.

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.

aaltat commented 1 month ago

@allcontributors please add @Andre-A-AtGithub for bugs

allcontributors[bot] commented 1 month ago

@aaltat

I've put up a pull request to add @Andre-A-AtGithub! :tada: