SUBSCRIBE HERE TO GET POST UPDATES VIA EMAIL :

Delivered by FeedBurner

How to use selenium IDE assertion "assertNotText" and "assertNotValue" commands

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
CommandTargetValue
openhttp://only-testing-blog.blogspot.in/2013/09/testing.html
assertNotTextcss=b > spanVisit Page
assertNotTextcss=b > spanVisit 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
CommandTargetValue
openhttp://only-testing-blog.blogspot.in/2013/09/testing.html
clickxpath=(//input[@name='gender'])[2]
assertNotValuexpath=(//input[@name='gender'])[2]off
assertNotValuexpath=(//input[@name='gender'])[2]on
assertValuexpath=(//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