Selenium IDE provided the user with a rich set of commands for manipulating the application under test. As discussed previously these commands can be broadly classified into actions, accessors and assertions. Making use of these various selenese commands a user can perform various actions such as checking for the existence of various UI elements, check for links present, enter data into text fields, select from drop down lists, etc. Besides these they can also perform actions such as switch between windows, scroll through a page, test Ajax functionality and many other web application features.
We shall see in detail some of the most commonly used selenium commands.
open : The command is used to open a web page in the test frame of the browser. The open command implicitly waits for the page to load before proceeding.
Command | Target | Value |
open |
type : The type command allows a user to type in text into text fields present on the page of the web application. The target is the locator object which is the text filed and the value is the text to be entered.
Command | Target | Value |
type | id=userName | netNinja |
click : The command performs a click operation on the locator object that is specified as target.
Command | Target | Value |
click | id=loginbtn |
select : The select command helps in selecting a value from the drop down locator object specified as target. Ex selecting the colour black from the colour list drop down.
Command | Target | Value |
select | id=colorList | Black |
verifyText : This command verifies whether the text specified in the value field for a particular locator object present on the page.
Command | Target | Value |
verifyText | id=field | text |
verifyElementPresent : This command verifies the locator object specified is present on the page.
Command | Target | Value |
verifyElementPresent | id=object |
NOTE: Even is verification commands fail the text case execution does not stop. It continues.
waitForElementPresent : The command causes the execution to pause until the expected locator object is present on the page. This command can be used as a checkpoint to confirm that the intended page has been reached. For example in order to make sure that one has navigated to the wikipedia home page we can wait until the wikipedia logo is displayed.
Command | Target | Value |
waitForElementPresent | id=logo |
No comments:
Post a Comment