Forum Discussion

radu's avatar
radu
Occasional Contributor
6 years ago

disable screenshot for Log.Error

 

Dear all,

 

Is there a way to instruct TestComplete (TC) not to take a screenshot for certain situations?

 

For example you create a function which deletes a folder from C drive, but for a certain reasons the deletion doesn't work, and an error occurs; at this point TC takes a screenshot and adds it to the report, although showing a screenshot with your application/web application to the log doesn't add any value.

 

Is it possible to write something for the Picture parameter so that the screenshot is not taken?

Log.Error(MessageText, AdditionalInformation, Priority, Attr, Picture, FolderID);

 

Thank you!

R

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    The option that is taking that screenshot is in your project properties (Tools | Options | Current Project Properties | Playback).  There's an option there that says, "post image on error".  If that's checked, any time a log entry of the Error type is written, it will take a picture.  This is a default event of your project, not a function of the Log.Error method.  For that function, either it will take pictures every time... or never.

    What I would suggest is that you turn that option off... and then, use the OnLogError event handler. Put logic in that handler that, if the error text does not contain a particular string, call "Log.Picture" and take your screenshot.  That way, you can filter the log so that, for certain errors, you don't get the screenshot.

     

     

  • baxatob's avatar
    baxatob
    Community Hero

    Hi,

     

    Open Project -> Properties -> Playback -> Log and turn off the option - "Post image on error"

     

    Then just omit the Picture argument in Log.Error() method.