Hello Gauri, Assertions in selenium can be used in 3 modes which are explained below:
- assert: If you use assert in your tests then the test will be aborted if the assert fails. Next test case will start executing in case you are running a test suite. So when the Assertion fails, all the test steps after that line of code are skipped. The solution to overcoming this issue is to use a try-catch block.
- verify: If verify is used then the test case will not abort even if the verify fails. It will continue executing and log the failure for the failed conditions. Mostly, the Verify command is used to check non-critical things. In such cases where we move forward even though the end result of the check value is failed.
- waitFor: waitFor command waits for the condition to become true. If the condition is true already the test case continues else it waits for the conditions to become true. If the condition doesn’t becomes true within specified time-out period test will fail and halt.