add an alternative to find_by_text that looks at all inner text
#862 opened on Mar 11, 2021
Repository metrics
- Stars
- (2,754 stars)
- PR merge metrics
- (PR metrics pending)
Description
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 or find_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