Jan021981
Jan021981

Reputation: 553

TestStack.White - using SearchCriteria.ByNativeProperty

Analysing with UI Spy, I want to get the following element: enter image description here

Looking at all this parameter, the "LabeledBy" parameter seems to be the best parameter to identify the element. I'm using TestStack.White for my automation and tried it that way:

TestStack.White.UIItems.IUIItem[] IUIArr = GetMainWindow().GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByNativeProperty(System.Windows.Automation.AutomationElement.LabeledByProperty, NUnit.Framework.Is.EqualTo(TestStack.White.UIItems.Finders.SearchCriteria.ByNativeProperty(System.Windows.Automation.AutomationElement.NameProperty, "NLP*"))));

GetMainWindow() is a function, returning the MainWindow of the application and it is working correctly.

My main problem is, that I get an exception with the text Der PropertyCondition-Wert für die AutomationElementIdentifiers.LabeledByProperty-Eigenschaft muss "AutomationElement" sein what means translated something like The value for property condition of an AutomationElementIdentifier.LabeledByPropery has to bei "AutomationElement"

My second and not soooo important question is: Do I really need to reference NUnit only for that one Is.EqualTo-Function? Usually I try to avoid referencing external DLLs, only for one method.

Unfortunatelly, I'm not so skilled using the nativ System.Windows.Automation library, but a solution without TestStack.White would also be helpful.

Upvotes: 1

Views: 517

Answers (0)

Related Questions