Selenium: IsTextPresent. Is text "abc" present in text "abcd"?
string searchText = "test this";
Sel.Type("//*[@id='txtbox']", searchText);
Sel.Click("//*[id='goButton']");
string highlightedTermsInResultsPage = Sel.GetText("//*[@id='searchTermMatch']"); //returns "test"
How can I compare searchText
and highlightedTermsInResultsPage
using IsElementPresent()
method? I want to check if highlig开发者_如何学编程htedTermsInResultsPage
matches part of searchText
or whole searchText
.
I'm not sure I understand the question, but maybe you can do
Sel.isElementPresent("//*[contains(child::text(), '" + searchText + "') and @id= 'searchTermMatch'])
精彩评论