Selenium Commands - Assertions


Advertisements

Assertions enable us to verify the state of an application and compares against the expected. It is used in 3 modes, viz. - "assert", "verify", and "waitfor". For Example, "verify if an item form the dropdown is selected".

The following table lists the Selenium assertions that are used very frequently, however the list is not exhaustive.

Sr.No. Command/Syntax & Description
1

waitForErrorOnNext (message)

Waits for error; used with the accessor assertErrorOnNext.

2

verifySelected(selectLocator, optionLocator)

Verifies that the selected option of a drop-down satisfies the optionSpecifier.

3

waitForSelected (selectLocator, optionLocator)

Waits for getting the option selected; used with the accessor assertSelected.

4

waitForNotSelected (selectLocator, optionLocator)

Waits for not getting the option selected; used with accessor the assertSelected.

5

verifyAlert (pattern)

Verifies the alert text; used the with accessor storeAlert.

6

waitForAlert (pattern)

Waits for the alert; used with the accessor storeAlert.

7

verifyAllButtons (pattern)

Verifies the button; used with the accessor storeAllButtons.

8

waitForAllButtons (pattern)

Waits for the button to load; used with the accessor storeAllButtons.

9

verifyAllLinks (pattern)

Verifies all links; used with the accessor storeAllLinks.

10

waitForAllLinks (pattern)

Waits for all links; used with the accessor storeAllLinks.

11

verifyAllWindowIds (pattern)

Verifies the window id; used with the accessor storeAllWindowIds.

12

waitForAllWindowIds (pattern )

Waits the window id; used with the accessor storeAllWindowIds.

13

verifyAttribute(attributeLocator, pattern)

Verifies an attribute of an element; used with the accessor storeAttribute.

14

waitForAttribute(attributeLocator, pattern)

Waits for an attribute of an element; used with accessor storeAttribute.

15

verifyBodyText(pattern)

Verifies the body text; used with the accessor storeBodyText.

16

waitForBodyText(pattern)

Waits for the body text; used with the accessor storeBodyText.

17

waitForConfirmation(pattern)

Waits for confirmation; used with the accessor storeConfirmationPresent.

selenium_selenese_commands.htm
Advertisements