Page 1 of 1

how can we get color of the text from an silver light applic

Posted: Mon Feb 16, 2015 1:26 pm
by sainath
Hello Support team,

I have a scenario where I need to get the color of the text from an silver light application. i have read previous posts and tried with get style and get attribute methods but I could not get the color of the text.

I would like to know is this possible through Ranorex if so, how?

Thanks,
Sainath

Re: how can we get color of the text from an silver light applic

Posted: Tue Feb 17, 2015 2:15 pm
by Support Team
Hi Sainath,

Ranorex uses accessibility (UI Automation) for testing of WPF and Silverlight applications. This accessibility (UI Automation) infrastructure unfortunately exposes only a subset of control properties which is limiting in some cases. When nonstandard attributes are used you therefore also need to expose them to UI Automation.
You may need to overwrite the IValueProvider for that element or simply bind the not identified attribute to one of the not used UI Automation attributes like the ItemStatus or the ItemType attribute.

So one workaround that is possible in this case is to use the ItemType property of UI Automation.
For example, in the below XAML snippet, just by adding the line in bold, the color of MyButton is exposed as ItemType and can be validate using Ranorex now:

Code: Select all

<Button
Name="btn" Background="Red"
AutomationProperties.ItemType="{Binding RelativeSource={RelativeSource Self}, Path=Background.Color}">
            MyButton</Button>
Regards,
Markus (S)

Re: how can we get color of the text from an silver light applic

Posted: Fri Mar 27, 2015 1:12 pm
by sainath
Hello Support Team,
I am very glad that your supporting me in all the difficulties I have faced while automating an application.
but, as you mentioned below I cannot get the code of the application and modify it. can you please guide me in such a way where I can use ranorex built in key words to get the text colour.


Thanks,
Sainath

Re: how can we get color of the text from an silver light applic

Posted: Tue Mar 31, 2015 1:12 pm
by Support Team
Hi Sainath,

Unfortunately I am afraid that you need to modify the source code of your application in order to get the text color of your desired element. Ranorex uses UI Automation in order to identify elements of a WPF application and this can be limiting in some cases since the UI Automation infrastructure only exposes a subset of predefined control properties and methods. Furthermore, it is also very likely that object identification issues are related to not correctly implemented UI Automation peers.

Thank you for your understanding.

Regards,
Markus (S)