This is a migrated thread and some comments may be shown as answers.

Access Tag property of FrameworkElement

3 Answers 60 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 16 Mar 2012, 12:21 PM
System.Windows.FrameworkElement class has a property called Tag (of type object).  It seems this is not exposed in ArtOfTest.WebAii.Silverlight.FrameworkElement class.  Is there a way to access the value of this property from the Telerik Testing Framework?

Thanks

3 Answers, 1 is accepted

Sort by
0
Accepted
Cody
Telerik team
answered on 16 Mar 2012, 08:34 PM
Hi Peter,

No I am sorry but it is not possible to reach the contents of the Tag property using Telerik Testing Framework? The problem is that there's no way to correctly serialize the data, send it across the wall (the division between the Silverlight application and the test execution code), and know how to deserialize it on the receiving end. It requires intimate knowledge of what' that "object" is before we can deserialize it for you to get at it.

Even if you tried to provide a deserialize method, there's no guarantee there's an equivalent Serialize method on the object for us to use. As a result we have blocked access to objects/types where it's basically impossible for us to know about during test execution.

Greetings,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Peter
Top achievements
Rank 1
answered on 18 Mar 2012, 01:51 AM
Thank you for confirming that.  FYI the scenario where I was hoping to use the Tag property was in identifying specific controls inside an ItemsPanel.  Since these controls can't have AutomationIDs (because they are created at runtime), I was planning on binding the Tag property to a string that is known to represent the control (e.g. "RegisterButton"), so that from test code, I can locate the RegisterButton within the ItemsPanel.  I have thought about creating a hidden TextBlock behind the button and binding it's Text to this string, but if there's a better way, I'd be very interested...

Peter
0
Cody
Telerik team
answered on 19 Mar 2012, 01:44 PM
Hi Peter,

If these controls are being generated dynamically at run time, and you have total control of the code, how about investigating taking advantage of SetAutomationId?

Greetings,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Peter
Top achievements
Rank 1
Answers by
Cody
Telerik team
Peter
Top achievements
Rank 1
Share this question
or