Wednesday, 27 April 2011

Example - Command - Echo

Aim:
A simple script to demonstrate the Echo command

Pre-requisites:
Key Steps
      1. Save the script as 'EchoCommand.html' on the PC
      2. Launch Firefox
      3. Open IDE
      4. Open the saved HTML script
      5. Run the script
      6. See how the echo command works.

Conclusions

Related Entries

Zip file location: ( download from here)
C:\FoundationSelenium\EchoScript\EchoCommandScript.html.



HTML script
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://foundation.time2test.co.uk/" />
<title>EchoScript</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">EchoScript</td></tr>
</thead><tbody>
<tr>
 <td>open</td>
 <td>/</td>
 <td></td>
</tr>
<tr>
 <td>clickAndWait</td>
 <td>link=Log in</td>
 <td></td>
</tr>
<tr>
 <td>assertTextPresent</td>
 <td>Username</td>
 <td></td>
</tr>
<tr>
 <td>assertTextPresent</td>
 <td>Password</td>
 <td></td>
</tr>
<tr>
 <td>echo</td>
 <td>&quot;Enter Username&quot;</td>
 <td></td>
</tr>
<tr>
 <td>type</td>
 <td>id=user_login</td>
 <td>admin</td>
</tr>
<tr>
 <td>storeValue</td>
 <td>id=user_login</td>
 <td>var1</td>
</tr>
<tr>
 <td>echo</td>
 <td>Username is : ${var1}</td>
 <td></td>
</tr>
<tr>
 <td>echo</td>
 <td>&quot;Enter Password&quot;</td>
 <td></td>
</tr>
<tr>
 <td>type</td>
 <td>id=user_pass</td>
 <td>time4test</td>
</tr>
<tr>
 <td>storeValue</td>
 <td>id=user_pass</td>
 <td>var2</td>
</tr>
<tr>
 <td>echo</td>
 <td>Password is :${var2}</td>
 <td></td>
</tr>
<tr>
 <td>clickAndWait</td>
 <td>id=wp-submit</td>
 <td></td>
</tr>
<tr>
 <td>waitForElementPresent</td>
 <td>//div[@id='user_info']/p/a[2]</td>
 <td></td>
</tr>
<tr>
 <td>clickAndWait</td>
 <td>link=Log Out</td>
 <td></td>
</tr>
<tr>
 <td>echo</td>
 <td>Logout from Application</td>
 <td></td>
</tr>
</tbody></table>
</body>
</html>



Helpful Video File


2 comments:

Thank you for your comment
- Time2test Team