Selenium IDE assertions "assertTitle" and "assertNotTitle" are used for asserting title of page. It will be useful when you want to check the title of each and every page. Selenium IDE has facility of Recording assertTitle automatically during recording of selenium script. It will add "assertTitle" command in your
script when you navigate from one page to another page. You can add commands in selenium IDE manually too.
Assertion "assertTitle" Command
"assertTitle" command will assert the title of current opened page and return "[error] Actual value 'Actual Title' did not match 'Targeted Title'" in log if targeted title and actual title did not match. Else it will be pass and will go for executing next command.
"assertNotTitle" Command for assertion
"assertNotTitle" command will be pass if targeted title and actual title did not match. Else it will return "[error] Actual value 'Actual Title' did match 'Targeted Title'" in log. Let me show difference with example.
Copy-paste bellow given example in your selenium IDE and run it.
New Test | ||
Command | Target | Value |
open | http://www.google.com/ | |
assertTitle | ||
assertNotTitle | Yahoo | |
assertNotTitle | ||
verifyTextPresent | Google Search |
In above example, "assertTitle" command will becomes pass because current opened page's title is 'Google' which is same as targeted. 3rd command "assertNotTitle" will be executed and pass successfully because current opened page's title 'Google' will not match with targeted title 'Yahoo' but 4th command will be fail so selenium IDE will not execute "verifyTextPresent" command.
No comments:
Post a Comment