Finding partial text
It is very common that you want to look for a snippet of text, rather than a text element that as a whole contains exactly what you look for; like when looking for a username on a page.
The current browser.is_text_present however only matches a text element 1:1. (and the documentation about this is not very clear that this is what is going on).
So if we have
<h1>Welcome, DeathSlayer!</h1>
Then browser.is_text_present("DeathSlayer") will return false, as will browser.is_text_present("Welcome, DeathSlayer") (because of the missing exclamation mark).
Could another command be introduced for this?
@andrewsmedina Hi, is anyone working on this? if not, then can I take it up?
Bump this. I think is a crucial feature, because text is not always known completely. For achiving this, maybe regex could be a very nice input to represent lookup in a more flexible way.
I was having trouble matching some text and saw this issue while looking for possible explanations. It may just be a version difference (I'm using 0.11.0) since this was opened, or perhaps I'm using a different driver, but I don't see this behavior with is_text_present.
I can match partial text just fine.
FWIW, the problem I was having was with matching text that spanned more than one element. I looked at the implementation and see that it's just calling roughly splinter.driver.find_element_by_tag_name("body").text.index(needle). In my case, checking the contents of splinter.driver.find_element_by_tag_name("body").text helped me identify what I needed to match against.
Edit: I did notice, however, that find_by_text (and methods that depend on it like is_element_present_by_text and is_element_not_present_by_text) compiles down into an xpath query that will only match the entire node's exact text.
Do not know if this issue was solved, but what about the contains() function in XPath, might help with the whole partial text issue.