How to drop down the tree view list

Ask general questions here.
sunitha
Posts: 24
Joined: Thu May 14, 2009 2:06 pm

How to drop down the tree view list

Post by sunitha » Wed Jun 03, 2009 1:54 pm

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

User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Post by Ciege » Wed Jun 03, 2009 4:03 pm

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}");
}