Selenese is a special test scripting language used by selenium for creating test cases. It a cross platform language used for representing the selenium commands. These are also referred to as selenese commands. Test scripts are created by writing these commands in proper sequence.
Making use of the 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.
Selenese commands are of three types mainly:
Actions: Actions are mainly used for manipulating the state of the web application. Some of the simple actions include clicking a UI element, selecting an option form a drop down list, typing a text into an input field, etc.
Accessors: These commands are used for checking the state of the web application and storing the result in some variables. Some of the commonly used assessor commands are ‘storeTitle’ and ‘storeTextPresent’.
Assertions: Assertion commands are used like checkpoints within the test script to verify that the state of the application conforms to an expected state specified by the user. Simple examples include the ‘assertText’ and ‘verifyElementPresent’.
Selenese script syntax
Selenium commands are written in sequence to form test scripts. The selenese test scripts are written in a 3 column format which consists of the selenese command and two optional parameters. These parameters are not always required. It depends on the selenese command that is used.
The command parameter is the selenese command chosen by the user such as ‘assertText’. The first parameter is the target. Target is the UI element on the web page over which the command has to executed. The second parameter is value. Value is the expected result when the particular command is executed on the target. Not all commands have a value and a target parameter.
NOTE: The target parameter which is the UI element can be located using the FIND button on the selenium IDE.
This 3 column format is the one which is displayed on the table tab of selenium IDE. These when displayed in the actual HTML format can be viewed from the source tab of the IDE.
No comments:
Post a Comment