Selenium IDE has many assertion commands to verify the presence of text, value, alert, confirmation, button, link, amny many more. You can Visit this page to look at all the assertion commands with example. "assertNotText" and "assertNotValue" commands are one of them and i am
going to describe both of them with example. "assertNotText" is the assertion for text and works opposite to "assertText" command. "assertNotValue" is related to "assertValue" command of selenium IDE and both are stands in opposition to each other.
"assertNotText" Command
"assertNotText" command verifies the presence of text on targeted element and will return error like '[error] Actual value 'Visit MyTest Page' did match 'Visit MyTest Page'' in log if targeted and actual value will match. If not match then it will be pass and selenium IDE will go remaining execution of script. You can run bellow given example to get it better.
New Test | ||
Command | Target | Value |
open | http://only-testing-blog.blogspot.com/2013/09/testing.html | |
assertNotText | css=b > span | Visit Page |
assertNotText | css=b > span | Visit MyTest Page |
In above example, 1st "assertNotText" will becomes pass because expected and actual value did not match but 2nd command will fail and return error.
"assertNotValue" Command
"assertNotValue" command will check the value of targeted element and will return error if both the value match. Else it will be pass. Look at bellow given example.
New Test | ||
Command | Target | Value |
open | http://only-testing-blog.blogspot.com/2013/09/testing.html | |
click | xpath=(//input[@name='gender'])[2] | |
assertNotValue | xpath=(//input[@name='gender'])[2] | off |
assertNotValue | xpath=(//input[@name='gender'])[2] | on |
assertValue | xpath=(//input[@name='gender'])[2] | on |
Here, 1st "assertNotValue" will be pass because targeted element (radio button) is selected so condition will be on!== off. 2nd "assertNotValue" command will fail because both value will match.
Try both the example in real scenarios with your software web site.
No comments:
Post a Comment