Need More Info
Last Updated: 16 Apr 2021 10:46 by ADMIN
Emma
Created on: 06 Apr 2021 19:54
Type: Feature Request
1
Add DisplayLabel to supported controls in ArtOfTest.WebAii.Silverlight.UI
DisplayLabels can contain text, but because it is not a supported FrameworkElement, it is difficult to work with in code. Tests instead have to store a path to the element and use the full name - like Applications.MyApp.MyWindow.DisplayLabel1 - every time I want to refer to it. It leads to a lot of repetitious code as well as storing of unnecessary elements, especially where a Find.AllByType would otherwise be able to take advantage of the consistent structure.
3 comments
ADMIN
Elena
Posted on: 16 Apr 2021 10:46

Hi Emma,

Thank you for your prompt response - it;s really helpful to sort out the type of control you need to automate. And since this is a custom modified control, we will not be able to add a translator for this one. 

Apart from this I reviewed the further notes you shared and there is a suggestion to share for a possible solution. Based on the DOM Explorer snippet I suspect that under the DisplayLabel element, there is a nested TextBox, which actually holds the Text property and can return the actual content.

If this is true, then you can use any of the Find.AllBy... methods applicable, and iterate through the found items (let's say using for each cycle), locate the TextBox under the current DisplayLabel (using the option to search under a defined element) and use its Text property. 

Please, note that this suggestion is only an assumption based on the details shared. You can give it a try and sort out if this will work for the specific case. In case you face any difficulties, or the proposed approach doesn't fit the app structure, please, let me know.

Thank you once again for your cooperation.

Please

Regards,
Elena
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Test Studio course! Check it out at https://learn.telerik.com/.
Emma
Posted on: 09 Apr 2021 21:37

I apologize, I was under the impression that DisplayLabel was an existing WPF control, when it appears to be a custom control for the application. As a result, I don't expect Test Studio to be able to add it. It appears to be some kind of modified TextBox, as seen in DOM:

The primary problem is that the Text property is not consistently accessible. If the element is located in the DOM and added to the Element Library, it can be accessed in code - Applications.MyApp.MyWindow.DisplayLabel1.Text will return the string of content as expected. However, for any sort of dynamic finding, such as Applications.MyApp.MyWindow.Find.ByExpression(new XamlFindExpression("XamlTag=DisplayLabel")), the element will be found correctly, but accessing the .Text property results in an empty string. This occurs no matter what dynamic find logic is used - XamlPath, indexing through .Children, Find.ByTextContent(), etc.

Here is a DOM snippet, with a DisplayLabel highlighted:

The ItemsControl at the top is easy to find using the name. The StackPanel contains multiple (the exact number may vary) ContentPresenters, all of which are structured the same way. I'd like to be able to loop through them, find the DisplayLabel, and get its text for validation purposes. 

ADMIN
Elena
Posted on: 08 Apr 2021 15:43

Hello Emma,

Thank you for contacting us with this request.

To help me in its evaluation, I will need some further details for the particular element. Can you, please, elaborate on what type of control is the DisplayLabels control? Is this some kind of custom control in the tested application? Can you share a snippet of the DOM tree where this control is used?  

Have you tried to use any of the other Find options? Is it an option to use Find.AllByTagName(), can this fit your requirements? 

I am looking forward to hearing back from you. Thank you in advance for your cooperation.

Regards,
Elena
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Test Studio course! Check it out at https://learn.telerik.com/.