cobrateam / cobrateam/splinter
add an alternative to find_by_text that looks at all inner text
- Dominant language
- Python
- Stars
- 2.7k
- Forks
- 511
- PR merge metrics
- No merged PRs in 30d
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
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the implementation of find_by_text and its related tests, then compare the current XPath with the proposed inner-text XPath for elements whose text spans multiple nodes. Decide on the alternative method name from the project’s existing naming patterns, add coverage for split text nodes, and confirm the existing find_by_text behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100