Aim:
Create your first Selenium Record and Playback Test Script and execute against the test site.
Difficulty Level: Easy
What you will learn?
Commands Used in Example
What you learned?
Nov 2012 - Please use the script on this entry as the download version may be out of date.
Zip file location: ( download from here)
C:\FoundationSelenium\Ex1\FirstScript.html
Script in HTML :
Helpful Video:
Create your first Selenium Record and Playback Test Script and execute against the test site.
Difficulty Level: Easy
What you will learn?
- Creation of the first selenium script
- Notepad++ to modify the script and notice the syntax highlighting
- Saving the script as ".html" is good practice
- Firefox browser with Selenium IDE installed ,use link How to install Selenium IDE?
- Notepad++ installed that allows syntax highligting
Tips:
- Use ".html" extension when naming the test suite and test cases
- Use Notepad++ to edit the files with syntax highlighting
- navigate to the http://foundation.time2test.co.uk
- login using username: admin, password: time4test
- Click on "user info"
- click on "posts"
- click on "add new"
- Enter "title"
- Click "publish"
- Click on Logout
- ( also ensure to add in the assertion command to your script)
Commands Used in Example
- open
- clickAndWait
- assertTextPresent
- type
What you learned?
- Selenium IDE to record a script against a content management system
- Selenium IDE commands
- Syntax Highlighting in Notepad++ helps with debugging
- Selenium IDE scripts saving and opening
- Concept of asserting for text
Nov 2012 - Please use the script on this entry as the download version may be out of date.
Script in HTML :
<?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>FirstScript</title> </head> <body> <table cellpadding="1" cellspacing="1" border="1"> <thead> <tr><td rowspan="1" colspan="3">FirstScript</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>type</td> <td>id=user_login</td> <td>admin</td> </tr> <tr> <td>type</td> <td>id=user_pass</td> <td>time4test</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=Posts</td> <td></td> </tr> <tr> <td>assertTextPresent</td> <td>Dashboard</td> <td></td> </tr> <tr> <td>clickAndWait</td> <td>link=Add New</td> <td></td> </tr> <tr> <td>type</td> <td>id=title</td> <td>MyFirstPost</td> </tr> <tr> <td>clickAndWait</td> <td>id=publish</td> <td></td> </tr> <tr> <td>clickAndWait</td> <td>link=Log Out</td> <td></td> </tr> <tr> <td>assertElementPresent</td> <td>id=user_login</td> <td></td> </tr> <tr> <td>assertElementPresent</td> <td>id=user_pass</td> <td></td> </tr> </tbody></table> </body> </html>
Helpful Video:
notes:
ReplyDeletethe video needs to show the scipt being recorded.
I have updated exercise's slide as well.
ReplyDeleteAdd an assertion at the end of the recorded script after the Logout.
ReplyDeleteIt's done
ReplyDeleteadd notes to install Notepad ++
ReplyDelete