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

getVisibleText vs getElementText, regression? #5761

Closed
43081j opened this issue Apr 11, 2018 · 0 comments · Fixed by #5762
Closed

getVisibleText vs getElementText, regression? #5761

43081j opened this issue Apr 11, 2018 · 0 comments · Fixed by #5762
Labels

Comments

@43081j
Copy link
Contributor

43081j commented Apr 11, 2018

It seems we may have at some point broken the ability to get the text of an element.

I did a PR last year (#4230) to introduce shadow tree traversal when retrieving element text.

The general idea of this PR was to modify getElementText such that it will follow distributed children through slot and content elements, along with taking shadowRoot into account on each element.

However, having (painfully) stepped through the latest selenium source, it seems we now call getVisibleText instead.

This function appears to have knowledge of shadow dom, but presumably has a bug somewhere which im hitting (and trying to reproduce for you).

So:

  • can someone explain selenium-atoms vs atoms?
  • why do we have two apparently unrelated functions to retrieve element text?
  • we used to use getElementText in some way because older versions of selenium don't have the problem im seeing

The issue is that some shadow DOM children return empty text but do have text

Selenium is incredibly difficult to debug and often involves jumping through many hoops. So without spending another several hours trying to get my head around it, i cant really figure out where these "atoms" go and how they are used. if someone could give an overview somewhere, that would be very useful.

I had to pretty much attach to the chrome instance (devtools), break, then try to access the text of the element in my tests so my devtools catches the injected code. the injected code is obviously minified by this point and near unreadable. is there a better debug process/method for debugging the injected JS?

FYI, executing getElementText manually (through a very hacky execute call via webdriver) on the element results in the correct text.


edit: i opened #5762 for this

@p0deje p0deje added the D-atoms label Apr 11, 2018
@lock lock bot locked and limited conversation to collaborators Aug 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants