Friday, 21 August 2009

Get the snapshots of web page using WATiN

This is very good feature added in WATiN tool. By using this we can get the snapshot of the web page where our test cases failed and that snapshot we can store at specify configurable location. Latter we can see the status of web page on failed test cases through snapshot.

Best part is that while sending automated test cases report we can attach failed test cases snapshots also with email to keep clarity about behavior of web page in failed condition.

Below is method to get snapshots of web page:

//Start of method

public void GetSnapshotUsingWatiN()

{

//Specify the location where we want to save all the snapshots.

string location = "c://ruby/";

//Open new instance of Internet Explorer

IE ie=new IE();

//Go to any specify website

ie.GoTo("http://jawedm.blogspot.com");

//Capture the snapshot of open web page and save it at mention

location.

ie.CaptureWebPageToFile(location +"/SnapshotUsingWatin.jpg");

}//end of method.



No comments: