How to drop down the tree view list
How to drop down the tree view list
In my application i have a Browse when clicked on it opens the Tree View control. How to go to c:\Program Files.. or any desired location using Ranoex tool
This was my solution to traversing a Browse for Folder dialog to select a specific folder in the tree structure. There is probably a better/easier way to do it, but it works for me.
Code: Select all
//Browse for Folder Dialog
HDUniqueForm = WaitForWindow("Browse For Folder", 20);
if (HDUniqueForm != null)
{
HDUniqueForm.EnsureVisible();
Ranorex.TreeItem HDTreeItem = HDUniqueForm.FindSingle(".//treeitem[@text='My Computer']", 5000);
HDTreeItem.EnsureVisible();
Mouse.Click(HDTreeItem);
HDTreeItem = HDUniqueForm.FindSingle(".//treeitem[@text='Local Disk (C:)']", 5000);
HDTreeItem.EnsureVisible();
Mouse.Click(HDTreeItem);
HDTreeItem = HDUniqueForm.FindSingle(".//treeitem[@text='Temp']", 5000);
HDTreeItem.EnsureVisible();
Mouse.Click(HDTreeItem);
HDTreeItem = HDUniqueForm.FindSingle(".//treeitem[@text='ReportsTest_" + strDateTimeStamp + "']", 5000);
HDTreeItem.EnsureVisible();
Mouse.Click(HDTreeItem);
HDTreeItem = HDUniqueForm.FindSingle(".//treeitem[@text='" + strCGCDirectory + "']", 5000);
HDTreeItem.EnsureVisible();
Mouse.Click(HDTreeItem);
Keyboard.Press("{Enter}");
}