Aim:
Use an existing test script and use the capture screenshot command.Easy
What you will learn?
- usage of the Capture Screenshot command
- location of the saved image
- good for debugging
Tips:
1. save the screenshot to the location where the test script exists
2. stuck for a script, use the below test script and notice the random variable used for the screenshot.
Pre-requisites:
- Firefox browser with Selenium IDE installed ,use link How to install Selenium IDE?
1. take an existing test script
2. add the capture screenshot command
3. open up the saved screenshot
Conclusions
Related Entries
Solution:
C:\FoundationSelenium\Ex7\CaptureEntirePageScreen.html.
Test script:
HTML test 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>CaptureEntirePage</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">CaptureEntirePage</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>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>waitForElementPresent</td>
<td>//div[@id='wpbody-content']/div[3]/h2</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>javascript{"Post" + new Date().getMilliseconds();}</td>
</tr>
<tr>
<td>captureEntirePageScreenshot</td>
<td>C:Image1.jpg</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=publish</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Users</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Users</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//li[@id='menu-users']/div[3]/ul/li[2]/a</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=user_login</td>
<td>javascript{"Test" + new Date().getMilliseconds();}</td>
</tr>
<tr>
<td>type</td>
<td>id=email</td>
<td>javascript{"Test" + new Date().getMilliseconds()+"@gmail.com";}</td>
</tr>
<tr>
<td>type</td>
<td>id=first_name</td>
<td>TestFirst</td>
</tr>
<tr>
<td>type</td>
<td>id=last_name</td>
<td>TestLast</td>
</tr>
<tr>
<td>type</td>
<td>id=url</td>
<td>http://www.google.com/</td>
</tr>
<tr>
<td>type</td>
<td>id=pass1</td>
<td>time2test</td>
</tr>
<tr>
<td>type</td>
<td>id=pass2</td>
<td>time2test</td>
</tr>
<tr>
<td>captureEntirePageScreenshot</td>
<td>C:Image2.jpg</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=addusersub</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Log Out</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
Helpful video
notes
ReplyDeletehtml script using syntaxhighlighter
video should mention the directory where the image will be stored.
It's done...
ReplyDeleteThe wordpress site has changed and I had to update many of the values in the script for it to run
ReplyDeleteDue to the nature of the internet, things will change. The essence of this example is to demo the screenshot command: captureEntirePageScreenshot
ReplyDeleteand locate the screenshot on your hardrive.
If you have not managed this then we will demonstrate this to you over a skype/teamviewer session.