QTP Forum
Shopmotion


Capturing Screen Shot and to Display in Qtp Results Empty
Search
 
 

Display results as :
 


Rechercher Advanced Search

Poll
Keywords

Latest topics
September 2019
MonTueWedThuFriSatSun
      1
2345678
9101112131415
16171819202122
23242526272829
30      

Calendar Calendar

Affiliates
free forum


Capturing Screen Shot and to Display in Qtp Results

Go down

Capturing Screen Shot and to Display in Qtp Results Empty Capturing Screen Shot and to Display in Qtp Results

Post by thomasdfg on Wed Jun 18, 2014 4:08 pm

you should start with following code
Code:
RegisterUserFunc "Page", "CaptureScreenshot", "CaptureScreenshot"
RegisterUserFunc "Browser", "CaptureScreenshot", "CaptureScreenshot"
RegisterUserFunc "Frame", "CaptureScreenshot", "CaptureScreenshot"
RegisterUserFunc "Dialog", "CaptureScreenshot", "CaptureScreenshot"
RegisterUserFunc "swfWindow", "CaptureScreenshot", "CaptureScreenshot"

use the following line where you want take screenshot or snapshot

Code:
Browser("micclass:=Browser").Page("micclass:=Page").CaptureScreenshot
 micPass, "<h4 align = ""Center"">Page SuccessFully
Displayed</h4>"
The below code is a library file. Add the library file to the script
Code:
Public Sub CaptureScreenshot( ByRef Sender, ByVal micStatus, ByVal descriptionStr )  
    Dim dateTimeNow, fileNameStr, divDesc, caption
    Dim dicMetaDescription, qtp
    dateTimeNow = DotNetFactory.CreateInstance( "System.DateTime" ).Now.ToString( "ddMMyyHHmmss" )    
    fileNameStr = Reporter.ReportPath & "\" & dateTimeNow & ".png"    
    Set qtp = CreateObject( "QuickTest.Application" )  
    qtp.Visible = False
    Wait 0, 500    
    If IsObject( sender ) Then      
    Sender.CaptureBitmap fileNameStr, True      
    caption = Sender.ToString & " - Capture Bitmap"    
Else      
    Desktop.CaptureBitmap fileNameStr, True      
    caption = "Desktop - Capture Bitmap"    
End If
    qtp.Visible = True
    divDesc = "<table align='center' border='5' cellpadding='1'
cellspacing='1' width='100%' title='" & fileNameStr & "'
frame='hsides'>" & _              
                   "<caption>" & caption & "</caption>" & _              
                   "<thead><tr><th>Application
Exception Description</th></tr></thead>" &
_ "<tfoot><tr><td
align='center'><img border='2px' src='" & fileNameStr & "'
 /></td></tr></tfoot>" & _              
                   "<tbody><tr><td>" &
descriptionStr &
"</td></tr></tbody></table>"    
    Set dicMetaDescription = CreateObject( "Scripting.Dictionary" )    
    dicMetaDescription( "Status" ) = micStatus    
    dicMetaDescription( "PlainTextNodeName" ) = "ApplicationException"    
    dicMetaDescription( "StepHtmlInfo" ) = "<DIV align=center>" & divDesc & "</DIV>"  
    dicMetaDescription( "DllIconIndex" ) = 205    
    dicMetaDescription( "DllIconSelIndex" ) = 205
    dicMetaDescription( "DllPAth" ) = EnVironment( "ProductDir" ) & "\bin\ContextManager.dll"  
    Call Reporter.LogEvent( "User", dicMetaDescription, Reporter.GetContext )
    dicMetaDescription("User") =  EnVironment ("dicMetaDescription")
    dicM
End Sub
thomasdfg
thomasdfg

Posts : 11
Join date : 2014-06-18
Age : 34
Location : Hyderabad

View user profile

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum