Ask a Question

disable screenshot for Log.Error

Occasional Contributor

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!


Community Hero



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


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

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.



Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Showing results for 
Search instead for 
Did you mean: