Difference between verifyText and verifyTextPresent in Selenium
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
精彩评论