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
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
Test Studio Trainings
Hi, Elena,
Thanks for the reply. I need to test for validation error.
Please see an example on the picture.
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
Test Studio Trainings
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
Thanks for your feedback. I am glad to know you found a suitable solution for you.
Regards,
Elena Tsvetkova
Progress Telerik
Test Studio Trainings