Search code examples
qtphp-uft

Take snapshot or screenshot while highligting the field in QTP during runtime


I am trying to take screenshot of a field while highlighting that field during run time in QTP.

systemUtil.Run "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", "--ignore-certificate-errors -incognito " & "www.google.com"

Browser("Google").Page("Google").WebEdit("Search").highlight

While Browser("Google").Page("Google").WebEdit("Search").highlight = True
Browser("Google").Page("Google").WebEdit("Search").CaptureBitmap("C:\Google.bmp")
Wend

Thanks, any lead would be helpful for me.


Solution

  • Both the Highlight and CaptureBitmap methods are synchronous, this means that by the time the function returns the highlight operation/bitmap capturing have finished. In order to capture the flashing of the highlight you would need to create your own function that captures the screen a certain length of time after it has finished running, this will probably require multi-threading and isn't a good fit for VBScript.

    Another thing you can do is tell UFT to capture a movie of the test run, this will include the highlighted object (you'll then have to manually find the spot in the clip and capture it).

    See Tools -> Options -> GUI Testing -> Screen Capture -> Save movie for results.