Navigate SAPTreelist using UIAutomation

  • Thread starter Thread starter Adinb007
  • Start date Start date
A

Adinb007

Guest
Hi Folks,

I need to double click on the child node below, i am able to get automation element for this SAPTreelist control but not sure how to navigate to the said child node and double click it.

1594020.png

Control Hierarchy using Spy++ along with control properties

1594021.png

Here is my C# Code




public bool SAPTreeList()
{

IntPtr parentHandle = FindWindow("#32770", "Archive from Frontend");

SwitchToThisWindow(parentHandle, true);
bool result = false;

try
{
var parentElements = AutomationElement.FromHandle(parentHandle).FindAll(TreeScope.Descendants, Condition.TrueCondition);
foreach (AutomationElement parentElement in parentElements)
{
if (parentElement.Current.ClassName != "")
{
if (parentElement.Current.ClassName == "SAPTreeList")

{
AutomationElement aeButton = parentElement.FindFirst(System.Windows.Automation.TreeScope.Element, new System.Windows.Automation.PropertyCondition(System.Windows.Automation.AutomationElement.NameProperty, parentElement.Current.Name));


}
}
}
}

catch (Exception ex)
{
result = false;

}
return result;
}




Aditya Sharma

Continue reading...
 
Back
Top