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:
ContentPresenter searchScroll = WindowScreenActuarialAssumptions.MainWindow.Find.ByExpression(new XamlFindExpression("DataContext='Value is too large [> 40]'")).As<ContentPresenter>();
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!
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!
Yes, I found the solution :) Thanks for your help!
var warningMessageControl = WindowScreenActuarialAssumptions.MainWindow.Find.AllByType("TextBlock").Where(_ => _.TextLiteralContent.Contains("Value is too")).ToList();
Thanks for your feedback. I am glad to know you found a suitable solution for you.