public static TreeItem GetChildItem(this Ranorex.Tree item, string key, bool expand = true) { TreeItem childItem = null; try { foreach (var child in item.Items) { if (child.Text == key) { if (expand) { child.Expand(); } childItem = child; break; } } } catch (Exception ex) { throw new Exception("Failed : GetChildItem : " + ex.Message); } return(childItem); }
public static TreeItem GetItem(this Ranorex.Tree tree, string dbkey, bool isExpand = true) { TreeItem item = null; try { foreach (var itemtree in tree.Items) { if (itemtree.Text.Trim() == dbkey) { itemtree.Collapse(); if (isExpand) { itemtree.Expand(); itemtree.EnsureVisible(); } item = itemtree; System.Threading.Thread.Sleep(1000); break; } } } catch (Exception ex) { throw new Exception("Tree Get Item Failed : " + ex.Message); } return(item); }
public static string RandPick(this Ranorex.Tree tree, bool bAccountNumber) { Random randNum = new Random(); int r = randNum.Next(1, tree.Items.Count - 1); tree.Items[r].Select(); string sAccountNum; if (bAccountNumber) { // get account number sAccountNum = System.Text.RegularExpressions.Regex.Replace(tree.Items[r].ToString(), @"[^\d]", ""); } else { sAccountNum = null; } return(sAccountNum); }
public static string RandPick(this Ranorex.Tree tree) { return(RandPick(tree, false)); }
// To be tested public static void SelectTreeItem(this Ranorex.Tree aTree, string item) { aTree[item].Click(); }