Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bitmap Image
#1
Solved: 7 Years, 8 Months, 1 Week ago
Hi Ankur,


Is it possible to capture the bitmap image of our application and place the same in to the report sheet.

My application is a jave based application, in certain place i might get an expected negative result. In such case I need to capture the bitmap image and put the same in to the report sheet (report warning).

What I tried is
RV = JavaWindow("Project").CaptureBitmap("C:\Rajesh Training\Exported mlm\Compilation Error.bmp")
Reporter.ReportEvent micWarning, "MLM has a compilation error, please see the error message in the location C:\Rajesh Training\Exported mlm\Compilation Warning.bmp.", RV


Here RV is a variable which is storing the bitmap image in the above location but it is not displaying the image in the report sheet.

It is displaying RV = Empty.

Please let me know your comments.
Reply
#2
Solved: 7 Years, 8 Months, 1 Week ago
Nice question...

you can find the solution here... How to capture error screenshot?

In case you want to see screenshot for all errors you can simply go to Tools > Options > Run tab and check "Save still image capture to results" and select "For Errors" from dropdown.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Solved: 7 Years, 8 Months, 1 Week ago
Thank you very much,

I will try your method and let you know how it works.

once again thanks, its a great help.
Reply
#4
Solved: 7 Years, 8 Months, 1 Week ago
Hi Ankur,

I have tried with the above method

Code:
Errorpath = "C:\Rajesh Training\Exported mlm\Compilation Error.bmp"
JavaWindow("MainWindow").CaptureBitmap Errorpath,True
Reporter.ReportEvent micFail,object_snap,"&nbsp<img src='" & Errorpath &"'>"

For the above code I was geting declaration error (object_snap is not declared)

I though it may be the report description so I have modified the code as

Code:
Errorpath = "C:\Rajesh Training\Exported mlm\Compilation Error.bmp"
JavaWindow("MainWindow").CaptureBitmap Errorpath,True
Reporter.ReportEvent micFail,"The expected compilation error is displayed","&nbsp<img src='" & Errorpath &"'>"

Finally I got a result checkpoint failed but unfortunately I didnt see the captured bitmap image in the result sheet.

please let me know what is "object_snap".
Is it a variable? if so what is stored in it and what is the use of it.

Thanks in advance.
Reply
#5
Solved: 7 Years, 8 Months, 1 Week ago
no need to worry about that...if you see the Reporter.ReportEvent syntax... it's just a step name...you can customize it as you want

I see that there is a space in your image doc name ...remove the space or add some character like underscore. For ex: compilation_error.bmp
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#6
Solved: 7 Years, 8 Months, 1 Week ago
Hi Ankur,

I have removed that space on the variable and tried many times.
Even now my result sheet is not displaying the captured bitmap
I have tried by modifing the last line with and without space.

Code:
errorpath = "C:\Rajesh Training\Exportedmlm\CompilationWarning.bmp"
JavaWindow("MainWindow").CaptureBitmap errorpath,True
Reporter.ReportEvent micFail,"Compilation error is displayed.", "&nbsp<img src='"&errorpath&"'>"

With Space:

Code:
errorpath = "C:\Rajesh Training\Exportedmlm\CompilationWarning.bmp"
JavaWindow("MainWindow").CaptureBitmap errorpath,True
Reporter.ReportEvent micFail,"Compilation error is displayed.", "&nbsp<img src='" & errorpath &"'>"

I am geting just a text result as how it is written in the report.

If possible could you please attach your result sheet so that i can see that once.
My application is a Java based application, Is a this a reason I am not geting the expected result ? I am not sure.
Please let me know your comments.
Reply
#7
Solved: 7 Years, 8 Months, 1 Week ago
Hi,

Do u got any solution for the above issue.......
Reply
#8
Solved: 7 Years, 8 Months, 1 Week ago
my bad...I thought it would work with &nbsp; also but isn't. You can change it to &amp;
Reporter.ReportEvent micFail,"Compilation error is displayed.", "&amp;<img src='" & errorpath & "'>"

Now it should work... I have made changes to my post also...Thanks for pointing that out.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#9
Solved: 7 Years, 8 Months, 1 Week ago
Hi Ankur,

Thank you very much for your reply,

Finally the code is working

Hay man The bitmap capture is working, I have gone through your post once again and used the below code.

Code:
errorpath = "C:\Rajesh Training\Exported mlm\CompilationWarning.bmp"
JavaWindow("MainWindow").CaptureBitmap errorpath,True
Reporter.ReportEvent micFail,"Compilation Error","&lt;<img src='" & errorpath &"'>&gt;"
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  QTP - each step screenshot bitmap in to word balamurali 0 2,121 02-07-2018, 10:06 PM
Last Post: balamurali

Forum Jump:


Users browsing this thread: 1 Guest(s)