-
Notifications
You must be signed in to change notification settings - Fork 508
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
add an alternative to find_by_text that looks at all inner text #862
Comments
This seems like something better served by an example in the documentation for now. Since it's essentially:
A well documented example scenario showing the limitations of |
I seem to have run into this also, where an HTML document had been built up like:
In order to search for a single term in the middle of that content, this is the only XPath selector I've been able to get working in Splinter: I'm not an expert in XPath by any means, so it's possible there's a better selector; there were others that worked in the browser dev tools console, but not in Splinter. I tried the selector mentioned in the previous response and it didn't work for my scenario, so I wanted to add my solution to the mix. |
Hi, is this issue up for grabs? |
Hi, is this issue still open? |
Hi, is This issue Still Open? |
The current implementation of
find_by_text
uses the following xpath://*[text()="some text"]
, which only looks at the first text node within an element. This makes it difficult to query for elements with text split across multiple text nodes.I think it would be useful to add an alternative that acts more like
element.textContent()
, querying against all inner text of an element rather than its first text node. This can be done with the following xpath://*[.="some text"]
It could be called
find_by_text_content
orfind_by_inner_text
or something along those lines.I'm happy to do the implementation and make a pull request if people agree that there's a need / desire for this
The text was updated successfully, but these errors were encountered: