Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Snapshots - Test Results
#6
Not Solved
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

Bhadra I am sure the code will work because i used it in so many projects
Reply


Messages In This Thread
Snapshots - Test Results - by Bhadra - 11-10-2011, 08:04 PM
RE: Snapshots - Test Results - by vinod123 - 11-11-2011, 05:45 PM
RE: Snapshots - Test Results - by Bhadra - 11-12-2011, 01:04 AM
RE: Snapshots - Test Results - by vinod123 - 11-14-2011, 10:43 AM
RE: Snapshots - Test Results - by Bhadra - 11-14-2011, 10:50 AM
RE: Snapshots - Test Results - by vinod123 - 11-14-2011, 11:21 AM
RE: Snapshots - Test Results - by Bhadra - 12-15-2011, 04:59 PM
RE: Snapshots - Test Results - by Sathiya - 12-15-2011, 07:02 PM
RE: Snapshots - Test Results - by vinod123 - 11-03-2014, 03:24 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  capture screenshot using html code and view in QTP Test results Bhuvan 3 7,223 07-19-2013, 02:38 PM
Last Post: Bhuvan
  Get the Parent Folder name in Test Plan for a Test from Test Lab using QTP godsown 0 6,108 09-29-2011, 04:55 PM
Last Post: godsown
  how to export test results from QTP to QC uma87 5 10,548 09-29-2011, 03:35 PM
Last Post: uma87
  Changing the Default location for test results when using Test Batch Runner tool pointguard888 3 10,589 12-29-2009, 04:31 PM
Last Post: pointguard888
  QTP results in QC test lab Desh 3 6,850 10-09-2009, 12:12 PM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)