i am trying to print all innertext values for class xyz, but this is all i get printed "System.Collections.Generic.List`1[System.String]
public List<String> getL1Names()
{
UITestControl document = browinX.CurrentDocumentWindow;
HtmlControl control = new HtmlControl(document);
control.SearchProperties.Add(HtmlControl.PropertyNames.Class, "xyz");
UITestControlCollection controlcollection = control.FindMatchingControls();
List<string> names = new List<string>();
foreach (HtmlControl link in controlcollection)
{
if (link is HtmlHyperlink)
names.Add(control.InnerText);
}
return names;
}
using this to print
Console.WriteLine(siteHome.getL1Names());
That is because
System.Collections.Generic.List<T>
does not overload ToString(). The default implementation (inherited from System.Object) prints the name of the object's type, which is what you are seeing.You probably mean to iterate through all of the elements in the list, and print each separately.
You can change
to something like