What are Selenium commands?
These are the set of commands which are used to run test cases. These Selenium commands are often called as Selenese. These are responsible for creating a testing language that supports testing environment.
Which portions of web pages tested using Selenese?
Selenium commands, AKA Selenese, helps an automation tester in testing UI elements based on their HTML tags, forms, input fields, data produced through table, broken link testing, lists, mouse position, window size testing, alerts, Ajax, event handling, pop up, testing a specific content and many more functionalities related to any web applications.
What are the types of Selenese?
There are mainly three types of Selenese.
- Actions: These are the commands which generally manipulate the state of the application. For example, creating a script to perform an action to click on the link and selecting a specific choice in given options. “AndWait” used to perform various actions. For example, “ClickAndWait” sends a call to the server and wait until new element or page displayed. Here if any action fails then the executions stop to proceeding further.
- Accessors: These commands generally store the results by examining the state of the application. Like, “storeTitle”.
- Assertions: These are like placing a checkpoint. They conform that expected results are visible or not. Assert, Verify and waitFor used in asserting any web pages and their elements. For example, assertText, verifyText, waitForText.
When an Assert fails then the test will abort, whereas when a Verify fails then the test will undergo its execution by logging its failure in the logs. A waitFor helps mainly in loading Ajax based application. When it fails then the test will either stop or halt the further execution.
Uses of Selenese in relation to Selenium IDE
Selenium scripts which are executed from Selenium IDE come in the form of HTML. They use HTML table which consists of Command, Target, and Value. So in command column, we put Selense and in target and value column we enter UI elements and their values respectively.
We use locators to identify UI elements. I have separately written an article on UI element so I will highly recommend you to go through that article.
List of Selenium commands used in Selenium IDE
- open – It opens a web page using an URL
- verifyTitle/assertTitle- It verifies the expected page title
- click- It performs click operation on a web element
- clickAndWait- It performs click operation and wait for the next element or page to appear
- verify/assertElementPresent- It verifies the presence of an expected UI element
- verify/assertTextPresent- It verifies the presence of expected Text on the web page
- verifyTable- It verifies the expected table and its data
- waitForElementPresent- It waits for the appearance of specific UI element so it pauses execution for that time
- waitForPageToLoad- It halts the execution until expected page loads
- echo- It performs to print text to test’s output
- assertPrompt- It verifies the alert prompt
- answerOnNextPrompt- It answers the alert on next prompt
- close- It closes the application
- doubleClick- It performs double click on a web element
- storeTitle- It gets the title of the web page
- verifyAlert- It verifies the presence of an alert
- storeAlert- It gets the text from the alert