I have a table which has multiple rows. I want to verify that a specific string StringName
is in the table. I used CodedUI to find the control, and the UI map is like this:
public class UIItemTable : WpfTable
{
#region Fields
private UIItemRow mUIItemRow;
#endregion
}
public class UIItemRow : WpfRow
{
#region Fields
private UIBlahBlahBlahCell mUIBlahBlahBlahCell;
#endregion
}
public class UIBlahBlahBlahCell : WpfCell
{
#region Fields
private WpfText mUIBlahBlahBlahText;
#endregion
}
I want to find a WpfText
that matches my StringName
. So I added a function to UIItemTable
:
public class UIItemTable : WpfTable
{
public WpfText Find(string StringName)
{
WpfText StringNameWpfText = new WpfText(this);
StringNameWpfText.SearchProperties[WpfText.PropertyNames.Name] = StringName;
return StringNameWpfText;
}
#region Fields
private UIItemRow mUIItemRow;
#endregion
}
But CodedUI cannot find the WpfText
control. The error I received is:
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException. The playback failed to find the control with the given search properties. Additional Details: TechnologyName: 'UIA' ControlType: 'Text' Name: ...
I think this error may be due to the fact that the WpfCell I want to search is actually a grandchild of the table. But I thought CodedUI handles tree traversals right? How do I search for a grandchild?