Images Comparison on version

Ask general questions here.
Posts: 9
Joined: Tue Apr 13, 2010 10:05 am

Images Comparison on version

Post by Enjoy » Wed Apr 14, 2010 4:27 pm

Hello! At this moment i need to automate some tests cases to my company, and i have the Ranorex version.

I need to compare 2 images of a graphic but that version don't have the hotkeys or the Image Based Validation. So i need some help. I tried the latest version 2.2 demo which features were available.Unfortunatlly i have to work on Ranorex version Can somebody help me?

How can i validate a image to compare with other one?Only by using code?How?
Ranorex didn't known the form like a .bmp?

When I record and try to validate the image Ranorex doesn't provide me the image validation and only validate the element with this path: /form[@controlname='TactChart']/container/container[@controlname='_togglePanel']/tabpagelist/tabpage[@controlname='_tabPageGraph']/container[@controlname='_zedGraphControl']

How can i do the code to compare with another image?if it´s possible

I tried this snipets:

Bitmap bmp = Ranorex.Imaging.Load(@"/form[@controlname='TactChart']/container/container[@controlname='_togglePanel']/tabpagelist/tabpage[@controlname='_tabPageGraph']/container[@controlname='_zedGraphControl']");


and i have 3 erros on the second line: CS1519
Last edited by Enjoy on Thu Apr 15, 2010 10:29 am, edited 1 time in total.

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

Re: Images Comparison on version

Post by Support Team » Thu Apr 15, 2010 10:28 am

Enjoy wrote: How can i validate a image to compare with other one?Only by using code?How?
In Version 2.1 there is no compare method available. The method is implemented in Ranorex 2.2

There is a possible way, but you have to write your own method to compare two images.
You can catch a bmp file with ranorex with following code
Bitmap bmp1 = Imaging.CaptureImage("yourElement");
//Image changes or do some actions
Bitmap bmp2 = Imaging.CaptureImage("yourElement");
But as I said to compare you have to write your own method, or u upgrade to Ranorex 2.2, this version provide a compare method for images.
Enjoy wrote:Ranorex.Imaging.Load(@"/form[@controlname='TactChart']/container/container[@controlname='_togglePanel']/tabpagelist/tabpage[@controlname='_tabPageGraph']/container[@controlname='_zedGraphControl']");
Will not work because you have to load a image and not an element path!
When you execute your code, normally you will get follwoing Excepetion:
"System.ArgumentException: Failed to load bitmap from file......"

Ranorex Support Team