SUBSCRIBE HERE TO GET POST UPDATES VIA EMAIL :

Delivered by FeedBurner

Selenum IDE Example of "assertElementPresent" and "assertElementNotPresent" commands

"assertElementPresent" Command
"assertElementPresent" command is useful to confirm element availability on page after user taking some action or navigate to some other page. It will force selenium to stop execution if targeted element not found on the page. It will continue execution if return result of condition "assertElementPresent" = false and will stop execution if return result of condition "assertElementPresent" = true.

In bellow given example, command "assertElementPresent" will verify that element "id=gbqfba" is there on the page or not. if element "id=gbqfba" (google search button) found on the page then it will execute next
command else it will return true in execution log and stop the execution.

New Test
CommandTargetValue
openhttps://www.google.co.in/
assertElementPresentid=gbqfba
typeid=gbqfqsoftware testing tutorials automation blog
clickid=gbqfb
pause3000
assertElementNotPresentid=gbqfb
typeid=gbqfqdownload selenium ide free

"assertElementNotPresent" command
in the opposite condition, "assertElementNotPresent" command will stop selenium execution if targeted element found on the page. In above example, "assertElementNotPresent" command verifies that element "id=gbqfb" (google search button) is there on the page? If yes then it will stop execution else it will execute next command.

No comments:

Post a Comment