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

Latest chrome exception handling for invisible element in move_to_element #262

Merged

Conversation

tpapaioa
Copy link
Collaborator

In chrome version 123 and later, calling move_to_element on a hidden element triggers a different exception:

Before:

selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable: [object HTMLHeadingElement] has no size and location

After:

selenium.common.exceptions.JavascriptException: Message: javascript error: {"status":60,"value":"[object HTMLHeadingElement] has no size and location"}

This PR updates move_to_element to handle it.

Before fix:

$ BROWSER=chrome pytest testing/test_browser.py
=== short test summary info ===
FAILED testing/test_browser.py::test_is_displayed_negative - selenium.common.exceptions.JavascriptException: Message: javascript error: {"status":60,"value":"[object HTMLHeadingElement] has no size and location"}
FAILED testing/test_browser.py::test_elements_check_visibility - selenium.common.exceptions.JavascriptException: Message: javascript error: {"status":60,"value":"[object HTMLParagraphElement] has no size and location"}
FAILED testing/test_browser.py::test_wait_for_element_visible - selenium.common.exceptions.JavascriptException: Message: javascript error: {"status":60,"value":"[object HTMLParagraphElement] has no size and location"}
FAILED testing/test_browser.py::test_wait_for_element_exception_control[with_exception] - selenium.common.exceptions.JavascriptException: Message: javascript error: {"status":60,"value":"[object HTMLParagraphElement] has no size and location"}
FAILED testing/test_browser.py::test_wait_for_element_exception_control[without_exception] - selenium.common.exceptions.JavascriptException: Message: javascript error: {"status":60,"value":"[object HTMLParagraphElement] has no size and location"}
FAILED testing/test_browser.py::test_element_force_visibility_check_by_locator - selenium.common.exceptions.JavascriptException: Message: javascript error: {"status":60,"value":"[object HTMLHeadingElement] has no size and location"}
=== 6 failed, 39 passed in 22.25s ===

After:

$ BROWSER=chrome pytest testing/test_browser.py
[...]
=== 45 passed in 30.39s ===

Copy link

codecov bot commented Aug 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.76%. Comparing base (6212348) to head (1d16798).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #262      +/-   ##
==========================================
+ Coverage   86.40%   86.76%   +0.36%     
==========================================
  Files          18       18              
  Lines        2567     2569       +2     
==========================================
+ Hits         2218     2229      +11     
+ Misses        349      340       -9     
Flag Coverage Δ
unittests 86.76% <100.00%> (+0.36%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@digitronik digitronik merged commit 7723d8f into RedHatQE:main Aug 29, 2024
17 checks passed
@tpapaioa tpapaioa deleted the chrome_invisible_element_workaround branch August 29, 2024 11:58
@mshriver mshriver mentioned this pull request Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants