Get Button Color

Class library usage, coding and language questions.
Posts: 1
Joined: Mon Aug 05, 2013 6:12 pm

Get Button Color

Post by ama » Mon Aug 05, 2013 6:38 pm


I have an application written in MFC. I'm trying to generate a test case validating communication
status by checking the back color of the button. The following is the code I'm running.
The winFormsButton returns as null. What am I missing?

Ranorex.Button button= "/form[@title='My App']/button[@text='Button1']";
Ranorex.Control winFormsButton = new Ranorex.Control(button);
Color temp = winFormsButton.GetPropertyValue<Color>("BackColor");

Will appreciate your support with that.


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

Re: Get Button Color

Post by Support Team » Wed Aug 07, 2013 1:24 pm


Does your button has Control properties?
Could you please try to use the following method to get this property:
Report.Info("BackColor: " + button.Element.GetAttributeValueText("BackColor"));
Markus (T)