From 7a4c9d066e4861a0f37cbaae34a9450c53d65282 Mon Sep 17 00:00:00 2001 From: "Fan, Jackie" Date: Thu, 6 Sep 2018 13:24:31 +0800 Subject: [PATCH] update TreeNodes:matchingnode to support regx compare and ignore case --- src/TestStack.White/UIItems/TreeItems/TreeNodes.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TestStack.White/UIItems/TreeItems/TreeNodes.cs b/src/TestStack.White/UIItems/TreeItems/TreeNodes.cs index b24d037b..58ffd44b 100644 --- a/src/TestStack.White/UIItems/TreeItems/TreeNodes.cs +++ b/src/TestStack.White/UIItems/TreeItems/TreeNodes.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Text.RegularExpressions; using System.Windows.Automation; using TestStack.White.AutomationElementSearch; using TestStack.White.Factory; @@ -32,7 +33,7 @@ public virtual TreeNode GetItem(params string[] path) private TreeNode MatchingNode(string nodeText) { - return Find(treeNode => treeNode.Text.Equals(nodeText)); + return Find(treeNode => Regex.IsMatch(treeNode.AutomationElement.Current.Name, nodeText, RegexOptions.IgnoreCase)); } ///