Selenium IDE Commands Each Selenium IDE test step can chiefly be split into following three components: Types of Selenium IDE commands There are three flavors of Selenium IDE commands. Each of the test step in Selenium IDE falls under any of the following category. - Actions
- Accessors
- Assertions
Actions Actions are those commands which interact directly with the application by either altering its state or by pouring some test data. For Example, “type” command lets the user to interact directly with the web elements like text box. It allows them to enter a specific value in the text box and as when the value is entered; it is showed on the UI as well. Another example is “click” command. “click” command lets the user to manipulate with the state of the application. In case of failure of an action type command, the test script execution halts and rest of the test steps would not be executed. Accessors Accessors are those commands which allows user to store certain values to a user defined variable. These stored values can be later on used to create assertions and verifications. For example, “storeAllLinks” reads and stores all the hyperlinks available within a web page into a user defined variable. Remember the variable is of array type if there are multiple values to store. Assertions Assertions are very similar to Accessors as they do not interact with the application directly. Assertions are used to verify the current state of the application with an expected state. Forms of Assertions: #1. assert – the “assert” command makes sure that the test execution is terminated in case of failure. #2. verify – the “verify” command lets the Selenium IDE to carry on with the test script execution even if the verification is failed. #3. waitFor – the “waitFor” command waits for a certain condition to be met before executing the next test step. The conditions are like page to be loaded, element to be present. It allows the test execution to proceed even if the condition is not met within the stipulated waiting period. Commonly used Selenium IDE commands [td]Command | Description | #Argu
ments | open | Opens a specified URL in the browser. | 1 | assertTitle, VerifyTitle | Returns the current page title and compares it with the specified title | 1 | assertElementPresent, verifyElementPresent | Verify / Asserts the presence of an element on a web page. | 1 | assertTextPresent, verifyTextPresent | Verify / Asserts the presence of a text within the web page. | 1 | type, typeKeys,
sendKeys | Enters a value (String) in the specified web element. | 2 | Click, clickAt,
clickAndWait | Clicks on a specified web element within a web page. | 1 | waitForPageToLoad | Sleeps the execution and waits until the page is loaded completely. | 1 | waitForElement
Present | Sleeps the execution and waits until the specified element is present | 1 | chooseOkOnNext
Confirmation,
chooseCancelOn
NextConfirmation | Click on ”OK” or “Cancel” button when next confirmation box appears. | 0 |
|