Ask a Question

how to specify the screenshot's name?

Occasional Contributor

how to specify the screenshot's name?

  1. Used "Post Screenshot" to capture a screenshot
  2. After executed the case, it will generate the log and screenshot, we notice that the screenshot's name default as "Picture 1/2/3", can we specify the screenshot name like this: Case no.1 - Customer, Case no.2 - Contract. Pls refer to the attached screenshot for more detail.
Esteemed Contributor

Not using the Post Screenshot method.  This is not intended to capture a screenshot and name it as a file, it is simply an operation to put a screenshot into the TestComplete test log.  By default, each picture in the log is named, simply, Picture1, 2, 3, etc.


In order to save the image with a particular name, you would call the "Picture" method of the onscreen object desired and then call the SaveToFile method from that... something like



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
Occasional Contributor

Aliases.MyApp.MyObject.Picture().SaveToFile('MyPictureFile.JPG') This method will name the screenshot and save to the specify path. So i have another question, can save the rename screenshot to the default log path instead of the specify path?
Occasional Contributor

I have resolved my question, thanks a lot. I use the Log.Patch method to get the path, and save the screenshot to this path. def test(): sPath = Log.Path Aliases.MyApp.MyObject.Picture().SaveToFile(sPath + "Case1_Customer.JPG")
Showing results for 
Search instead for 
Did you mean: