Selenium IDE Script Syntax

Selenium commands consist of the command and two parameters: Target and Value.


These parameters are not always required. The "Target" and "Value" parameters are depends on the command. In some cases, both are required, in other one parameter is required, and in others the command may take no parameters at all. For example:


verifyTextPresent   Welcome to Selenium Master
type id=login_login_username xxx
type id=login_login_password


type id=authenticationnumber


clickAndWait id=login_submit  

 The command reference describes the parameter for each command.

Selenium scripts that will be run from Selenium-IDE will be be stored in an HTML text file format. This consists of an HTML table with three columns. The first column identifies the Selenium command, the second is a target, and the final column contains a value. The second and third columns may not require values depending on the chosen Selenium command, but they should be present. Each table row represents a new Selenium command. Here is an example of a test that opens a page, asserts the page title and then verifies some content on the page:

<table cellpadding="1" cellspacing="1" border="1">
<tr><td rowspan="1" colspan="3">SeleniumMasterLoginTest</td></tr>
<tr><td>waitForElementPresent</td><td>css=img[alt=&quot;Selenium Master&quot;]</td><td></td>
<tr><td>assertText</td><td>css=#sb-onlineusers &gt; h3</td><td>Online users</td></tr>

When rendered as a table in a browser, this would look like the following.

open /seleniummastertestapp/index.php  
waitForElementPresent css=img[alt="Selenium Master"]  
type id=login_login_username xxxxx
type id=login_login_password xxxxx
clickAndWait id=login_submit  
assertText css=#sb-onlineusers > h3 Online users

The Selenese HTML syntax can be used to write and run tests without requiring knowledge of a programming language. With a basic knowledge of selenese and Selenium-IDE you can quickly produce and run testcases.