"assertElementPresent" Command
Selenium assert element present command is useful to confirm element availability on page after user taking some action or navigate to some other page. Selenium assert element present 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 | ||
Command | Target | Value |
open | https://www.google.co.in/ | |
assertElementPresent | id=gbqfba | |
type | id=gbqfq | software testing tutorials automation blog |
click | id=gbqfb | |
pause | 3000 | |
assertElementNotPresent | id=gbqfb | |
type | id=gbqfq | download selenium ide free |
"assertElementNotPresent" command
in the opposite condition, selenium assert element not present 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. This way you can use selenium assert element present and selenium assert element not present commands.
No comments:
Post a Comment