开发者

Difference between verifyText and verifyTextPresent in Selenium

开发者 https://www.devze.com 2023-02-19 18:33 出处:网络
I\'m trying to build a test using Selenium IDE and I want to check that a certain <div> block cont开发者_如何学Pythonains the correct text. What assertion should I use? What is the difference be

I'm trying to build a test using Selenium IDE and I want to check that a certain <div> block cont开发者_如何学Pythonains the correct text. What assertion should I use? What is the difference between text and textPresent?


*TextPresent commands check for the presence of the text in the entire page. This can often lead to false positives, and is not generally advised. *Text commands require a locator, and the text of the element located is directly compared. Another advantage is that a failure will give you details of the expected and actual text, whereas the former commands simply return true/false.

You will need a way to locate your <div> element, which is easiest if it has an id attribute. Check the official documentation for locator strategies: http://seleniumhq.org/docs/02_selenium_ide.html#locating-elements

0

精彩评论

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

关注公众号