Capturing Screenshot and Saving with Timestamp
Dim ScreenName
On Error Resume Next
ScreenName = ""
CurrentTime = "_Test_Case"&"_"& Day(Now)&"_"& Month(Now)&"_"& Year(Now)&"_"& Hour(Now)&"_"& Minute(Now)&"_"& Second(Now)
'Set the screen shot name
ScreenShotName = "Screenshot" & CurrentTime & ".png"
'Final screenshot location
ScreenName ="C:\Documents and Settings\Pankaj Kumar Ocmpf\Desktop\New Folder (2)"&"\"&ScreenShotName
' just capture
Desktop.CaptureBitmap ScreenName,True
******************************************************************
Public Function ScreenCapture()
Dim vNow, vFile
vNow = Replace(Replace(Replace(now(),":","_"),"/","_")," ","_")
vfile ="\\Cd102162\SOS_Optus\ "&vNow&".png"
'Capture Browser Scrren shot
Browser("micclass:=Browser").FullScreen
Browser("micclass:=Browser").CaptureBitmap vFile, True
' Add the Captured Screen shot to the Results file
Reporter.ReportEvent micDone,"Screen Shot","<<img src='" &vFile& "'>>"
End Function
Dim ScreenName
On Error Resume Next
ScreenName = ""
CurrentTime = "_Test_Case"&"_"& Day(Now)&"_"& Month(Now)&"_"& Year(Now)&"_"& Hour(Now)&"_"& Minute(Now)&"_"& Second(Now)
'Set the screen shot name
ScreenShotName = "Screenshot" & CurrentTime & ".png"
'Final screenshot location
ScreenName ="C:\Documents and Settings\Pankaj Kumar Ocmpf\Desktop\New Folder (2)"&"\"&ScreenShotName
' just capture
Desktop.CaptureBitmap ScreenName,True
******************************************************************
Public Function ScreenCapture()
Dim vNow, vFile
vNow = Replace(Replace(Replace(now(),":","_"),"/","_")," ","_")
vfile ="\\Cd102162\SOS_Optus\ "&vNow&".png"
'Capture Browser Scrren shot
Browser("micclass:=Browser").FullScreen
Browser("micclass:=Browser").CaptureBitmap vFile, True
' Add the Captured Screen shot to the Results file
Reporter.ReportEvent micDone,"Screen Shot","<<img src='" &vFile& "'>>"
End Function
Good afternoon
ReplyDeleteDo you know how I can get the image in .jpg or .jpeg format, I ask this because .bmp is too big, and I neef to take a lot of screenshots
I forgot to thank you, thanks for your help :D
ReplyDeletethanks alot
ReplyDeleteregards,
Neha
https://speakingdots.com
What's the use of following sentence:
ReplyDelete"\\Cd102162\SOS_Optus\ "
Is there any way to capture screen shot in hybrid framework?
ReplyDeleteScreenshot = "D:\"&Hour(Now)&".png"
ReplyDeleteBrowser("Login").Page("Login").CaptureBitmap Screenshot.True
This above code is working fine but when i use Now() or Time() functions in the place of Hour(Now) it's not working.
Screenshot = "D:\"&Now()&".png"
Browser("Login").Page("Login").CaptureBitmap Screenshot.True
Please help me with this query
Delete