开发者

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'])
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜