Page 1 of 1

Validating Size attribute

Posted: Mon Oct 15, 2012 11:59 am
by Warun
Hi,

I am using ranorex to validate sizes of UI elements such as buttons etc. But

ValidateAnyAttributeValueOfAutomationElement(
string path,
string attrName,
object expectedValue,
string message = "",
bool exceptionOnFail = false)

is throwing an error when we pass the following "expected value" argument: new System.Drawing.Size(width, height)
Please let me know how i can validate sizes of UI elements.

Thanks in advance!

Re: Validating Size attribute

Posted: Tue Oct 16, 2012 3:45 pm
by Support Team
Hi,

Which Ranorex method are you using in order to get the size of your element?

Regards,
Markus
Ranorex Support Team

Re: Validating Size attribute

Posted: Mon Oct 22, 2012 8:35 am
by Warun
The size of the button was constant. So, I just instantiated a new system.drawing.size object with those constant width and height values and passed it to the ranorex's validate method.

Re: Validating Size attribute

Posted: Mon Oct 22, 2012 10:54 am
by Support Team
Hi,

The following code should work for you:
var start = repo.Start.Start;
Validate.AreEqual(start.Element.Size, new Size(54, 40));
I used the Windows start button for test purposes and this worked as expected on my machine.

Regards,
Markus
Ranorex Support Team

Re: Validating Size attribute

Posted: Wed Nov 07, 2012 5:45 am
by Warun
Thanks a lot! It works!