how to specify the screenshot's name?
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2017
06:12 PM
06-06-2017
06:12 PM
how to specify the screenshot's name?
- Used "Post Screenshot" to capture a screenshot
- 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.
Solved! Go to Solution.
3 REPLIES 3
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2017
05:35 AM
06-07-2017
05:35 AM
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
Aliases.MyApp.MyObject.Picture().SaveToFile('MyPictureFile.JPG')
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2017
11:20 PM
06-07-2017
11:20 PM
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?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2017
12:24 AM
06-08-2017
12:24 AM
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")
