assertText (target, pattern) , verifyText (locator, text)- Selenium IDE command

assertText and verifyText both get the text of an element (as defined by the locator) and check if it meets the requirement of the pattern. This works for any element that contains text.

Assert and verify commands are both useful for verifying condition match or not. The difference is that verify command will verify the condition and if it does not match, it will only show an error message in log area and the macro continues to run. With the assert command, if the condition does not match then it will stop remaining macro execution in the selenium IDE software testing tools.

assertText and verifyText Example

In this short example, we check for the presence of the texts "Welcome" and "Free Web Automation". If "Welcome" is missing, the macro stops since we used assert.

Command Target Pattern/Text
assertText //*[@id="title"] Welcome
verifyText //*[@id="content"]/div[2]/div/h2[1] Free Web Automation

Works in

Kantu for Chrome Selenium IDE, Firefox IDE Classic

Related Demo Macros

DemoStoreEval uses many Asserts

The ready-to-import-and-run source code of all demo macros can be found in the Github repository testmacros folder.

See also

assertTitle, storeText, Web Automation Extension User Manual, Selenium IDE commands, Classic Firefox Selenium IDE.

Anything wrong or missing on this page? Suggestions?

...then please contact us.

Kantu Selenium IDE for Chrome and Firefox - Web Test Automation
Subscribe to the a9t9 automation software newsletter . We'll send you updates on new releases that we're working on.