Skip to content

"Get Text" atom has to return the visible text from an element within a closed ShadowDOM #13211

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

Merged

Conversation

whimboo
Copy link
Contributor

@whimboo whimboo commented Nov 28, 2023

Fixes #13132

Description

As discussed on issue #13132 the "Get Text" atom currently fails for elements that are located within a closed ShadowDOM. In those cases a check for .shadowRoot will not succeed because it's null. This patch fixes the check by making sure that it is only run when a valid ShadowRoot is actually available.

Motivation and Context

This currently blocks WebDriver implementations using the Get Text atom to correctly retrieve the visible text of such an element.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

… a closed ShadowDOM.

As discussed on issue SeleniumHQ#13132 the "Get Text" atom currently
fails for elements that are located within a closed ShadowDOM.
In those cases a check for ".shadowRoot" will not succeed
because it's "null". This patch fixes the check by making sure
that it is only run when a valid ShadowRoot is actually available.

 # Please enter the commit message for your changes. Lines starting
@whimboo
Copy link
Contributor Author

whimboo commented Nov 28, 2023

CC @43081j and @AutomatedTester for review. Thanks!

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (36585d1) 57.53% compared to head (0be2e04) 57.53%.

❗ Current head 0be2e04 differs from pull request most recent head 0dac4d2. Consider uploading reports for the commit 0dac4d2 to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##            trunk   #13211   +/-   ##
=======================================
  Coverage   57.53%   57.53%           
=======================================
  Files          86       86           
  Lines        5310     5310           
  Branches      221      221           
=======================================
  Hits         3055     3055           
  Misses       2034     2034           
  Partials      221      221           

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

@whimboo
Copy link
Contributor Author

whimboo commented Nov 28, 2023

@AutomatedTester the failing test for Firefox doesn't look like that it has been caused by my PR. Can you please check? Thanks!

@AutomatedTester AutomatedTester merged commit bd5cbe5 into SeleniumHQ:trunk Nov 29, 2023
dev-velo pushed a commit to dev-velo/selenium that referenced this pull request Nov 29, 2023
… a closed ShadowDOM (SeleniumHQ#13211)

"Get Text" atom has to return the visible text from an element within a closed ShadowDOM.

As discussed on issue SeleniumHQ#13132 the "Get Text" atom currently
fails for elements that are located within a closed ShadowDOM.
In those cases a check for ".shadowRoot" will not succeed
because it's "null". This patch fixes the check by making sure
that it is only run when a valid ShadowRoot is actually available.

 # Please enter the commit message for your changes. Lines starting
@whimboo whimboo deleted the atom_get_text_closed_shadow_root branch December 6, 2023 11:24
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.

[🐛 Bug]: "Get Text" atom returns an empty string for elements within a closed ShadowDOM
4 participants