Selenium WebDriver Java Framework Course Limited Time Offer for $20

Selenium WebDriver Java Framework Course Limited Time Offer for $20

 

Print

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:

 

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

xxx

type id=authenticationnumber

${myauthenticationNumber}

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">
<thead>
<tr><td rowspan="1" colspan="3">SeleniumMasterLoginTest</td></tr>
</thead><tbody>
<tr><td>open</td><td>/seleniummastertestapp/index.php</td><td></td></tr>
<tr><td>waitForElementPresent</td><td>css=img[alt=&quot;Selenium Master&quot;]</td><td></td>
</tr><tr><td>type</td><td>id=login_login_username</td><td>xxxxx</td></tr>
<tr><td>type</td><td>id=login_login_password</td><td>xxxxx</td></tr>
<tr><td>clickAndWait</td><td>id=login_submit</td><td></td></tr>
<tr><td>assertText</td><td>css=#sb-onlineusers &gt; h3</td><td>Online users</td></tr>
</tbody></table>

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

SeleniumMasterLoginTest
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.