Get Button Color

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

Get Button Color

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

Hello,

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.

Thanks

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Get Button Color

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

Hello,

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"));
Regards,
Markus (T)
.
Image