Page 1 of 1

How to drop down the tree view list

Posted: Wed Jun 03, 2009 1:54 pm
by sunitha
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

Posted: Wed Jun 03, 2009 4:03 pm
by Ciege
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}");
}