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

<No Name> Element

5 Answers 8 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 28 Sep 2017, 11:58 AM

Hi,

Is it possible to get the element with <No Name>?

Using "ByExpression" I need to get a value: "Value is too large [> 40]"

I try to like this: 

Example1:

ContentPresenter searchScroll = WindowScreenActuarialAssumptions.MainWindow.Find.ByExpression(new XamlFindExpression("DataContext='Value is too large [> 40]'")).As<ContentPresenter>();

 

Example2: 

            var txtBlock = WindowScreenActuarialAssumptions.MainWindow.Find.ByTextContent("");

 

 

5 Answers, 1 is accepted

Sort by
0
Elena
Telerik team
answered on 02 Oct 2017, 12:27 PM
Hello Peter,

Thank you for reaching us out. 

Please find here additional details about the Find expression and how to build it in the Testing Framework here. I hope this would be helpful to you. 

Though in case you would like further assistance please provide some screenshots of the attributes and properties of the required element and which are these you would like to use. 

Thanks in advance! 

Regards,
Elena Tsvetkova
Progress Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Peter
Top achievements
Rank 1
answered on 04 Oct 2017, 11:15 AM

Hi, Elena,

 

Thanks for the reply. I need to test for validation error. 

Please see an example on the picture.

0
Elena
Telerik team
answered on 09 Oct 2017, 08:05 AM
Hello Peter,

Thank you for getting back. 

As of the screenshot provided and the previously shared information I would like to kindly ask for some further clarification. It seems that the text block does not have a name so this would not be an option to locate it. 

Though the TextContent should be working if it is unique on the page. The approach you have listed should work if you include the actual TextContent: 

var txtBlock = WindowScreenActuarialAssumptions.MainWindow.Find.ByTextContent("Element'sTextContent");

Have you tried and what the result would be? 

Please if you would need further assistance would it be possible to provide a sample application which contains such an element - this would be the easiest way to find a solution for the encountered difficulty. 

Thank you in advance for the cooperation! 

Regards,
Elena Tsvetkova
Progress Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Peter
Top achievements
Rank 1
answered on 10 Oct 2017, 05:59 AM

Hi Elena,

Yes, I found the solution :) Thanks for your help!

    WindowScreenActuarialAssumptions.MainWindow.RefreshVisualTrees();

            var warningMessageControl = WindowScreenActuarialAssumptions.MainWindow.Find.AllByType("TextBlock").Where(_ => _.TextLiteralContent.Contains("Value is too")).ToList();

Regards,

Peter

 

 

0
Elena
Telerik team
answered on 10 Oct 2017, 02:22 PM
Hi Peter,

Thanks for your feedback. I am glad to know you found a suitable solution for you. 

Regards,
Elena Tsvetkova
Progress Telerik
 
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
Elena
Telerik team
Peter
Top achievements
Rank 1
Share this question
or