How to store screenshot in a specific folder?

Ask general questions here.
Mague
Posts: 6
Joined: Wed Aug 26, 2015 1:23 am

How to store screenshot in a specific folder?

Post by Mague » Tue Sep 01, 2015 8:05 pm

Hi everyone,

I would like store active view screenshots in a specific folder and not in the report folder as currently.
Someone will have an idea on how to do this?

Thank you

Mague

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to store screenshot in a specific folder?

Post by odklizec » Wed Sep 02, 2015 8:22 am

Hi,

I don't think there is a way to redirect the report screenshots to user-specified directory. You can only disable (in Report settings) the collection of report images in a subdirectory. But then the images will be stored directly in the report folder. Another possibility (workaround) is to enable creation of compressed reports (rxzlog) and at the end of test delete content of report folder, except the rxzlog files.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: How to store screenshot in a specific folder?

Post by Support Team » Thu Sep 03, 2015 10:42 am

Hi Mague,

The images are also stored in the output directory. You can copy the screenshot directory from there to another location at the end of you test suite, for example within the teardown section.

A description how to copy directories can be found on the website https://msdn.microsoft.com/en-us/librar ... .110).aspx

I hope this helps.

Regards,
Bernhard

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to store screenshot in a specific folder?

Post by odklizec » Thu Sep 03, 2015 11:24 am

Hi Bernhard,

But if he moves the image directory somewhere else, he will also need to edit the rxlog.data file, which references the original image dir.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: How to store screenshot in a specific folder?

Post by krstcs » Thu Sep 03, 2015 2:45 pm

He should just COPY them somewhere else, not move them. No worries about them missing that way.
Shortcuts usually aren't...

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to store screenshot in a specific folder?

Post by odklizec » Thu Sep 03, 2015 3:09 pm

Yes Kelly, but how I understand it, he doesn't want to have the screenshots in report folder at all, but still be able to see them in reports? So I think the best/easiest solution is to use compressed rxzlog and delete everything else.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: How to store screenshot in a specific folder?

Post by krstcs » Thu Sep 03, 2015 6:37 pm

A few thoughts:

First, moving the screenshots will likely mess up the reports and should not be done. Even the Ranorex team suggests only copying, not moving, because of this.

Second, changing things like this without a very good reason (which we don't know) is almost never a good thing. This change would require what I see as unneeded extra work and would make the tests more brittle and subject to non-SUT-caused failure, while just copying the files will hurt nothing.

Third, there is not nearly enough information given in the original post to give us an accurate understanding as to WHY he might need the screenshots in another folder. If could be that he does just need a copy somewhere else, it could be that he wants to change the default location that the report screenshots are saved. We do not know. It would be helpful if Mague could expound on what he is trying to do so we could get a better picture (no pun intended...).

And the rxzlog still contains the exact same folder structure, it's just zipped. Again, without knowing exactly what he's wanting it's impossible to know if this would actually solve the perceived issue.

So, a bit more information from Mague would be extremely helpful.
Shortcuts usually aren't...

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: How to store screenshot in a specific folder?

Post by Support Team » Fri Sep 04, 2015 2:07 pm

Hi everybody,

I agree, the initial question is not clear. Mague didn't why he wants to do that and what he wants to do with the screenshots.
We should wait for the clarification and continue discussing that issue when we have more information.

Regards,
Bernhard

Mague
Posts: 6
Joined: Wed Aug 26, 2015 1:23 am

Re: How to store screenshot in a specific folder?

Post by Mague » Fri Sep 04, 2015 6:05 pm

Hi everyone,

thanks for all your answer.

I need to take screenshots of a mobile app and store them in a specific folder with a specific name because we perform localization QA tests.
But it's fine, I found a solution:

Code: Select all

//Take a screenshot of a specific element
Bitmap image = Imaging.CaptureImageAuto(element.Element);
//Name and path to store the screenshot
String imageName = String.Format("screenshot_{0}.jpg",i);
String pathImageName = Path.Combine(<path to store your screenshot>, <imageName>);
//Save the screenhot in your specific folder
image.Save(pathImageName, System.Drawing.Imaging.ImageFormat.Jpeg);