Friday, June 6, 2008

How to Capture the Screen Shot

By using the below script we can capture the screen shot at run time -

Browser("BrowserName").Page("PageName").captureBitmap "c:\test\ScreeShot1.bmp"

Below example will help you to get familiar with this-
'Prerequisite: Open the FlightReservation Login screen
'Then Run this Script

Set Dlg=Dialog("text:=Login")
set Wnd=Window("text:=Flight Reseravation")
Set oDlg=wnd.Dialog("text:=Open Order")

Dlg.WinEdit("attached text:=Agent Name").set "rajaputra"
Dlg.WinEdit("attached text:=Password").setSecure "mercury"
Dlg.WinButton("text:=OK").Click

wait (7)

wnd.Activate
wnd.WinButton("window id:=5").Click
oDlg.WinCheckBox("text:=&Order No.").Set "ON"
oDlg.WinEdit("window id:=1016").set "100"
oDlg.WinButton("text:=OK").Click

if(oDlg.Dialog("text:=Flight Reservations").Exist) then
oDlg.Dialog("text:=Flight Reservations").CaptureBitmap "C:\ScreenShot.bmp"
oDlg.Dialog("text:=Flight Reservations").WinButton("text:=OK").Click
oDlg.WinButton("text:=Cancel").Click
End If

wnd.Close

No comments:

Post a Comment