Guest User

Untitled

a guest
Jun 24th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.21 KB | None | 0 0
  1.         private UITestControl SearchFromParent(UITestControl searchFor, UITestControl searchFrom)
  2.         {
  3.             UITestControl result = null;
  4.             foreach (UITestControl Child in searchFrom.GetChildren())
  5.             {  
  6.                 Boolean match = true;
  7.                 foreach (PropertyExpression propertyInfo in searchFor.SearchProperties)
  8.                 {
  9.  
  10.                     if (!(Child.GetProperty(propertyInfo.PropertyName).ToString().Equals(propertyInfo.PropertyValue.ToString())))
  11.                     {
  12.                         match = false;
  13.                         TestContextLogText("ERROR::MESSAGE::" + Child.GetProperty(propertyInfo.PropertyName).ToString() + " VS " + propertyInfo.PropertyValue.ToString());
  14.                     }
  15.  
  16.                 }
  17.                 if(match)
  18.                 {
  19.                     return Child;
  20.                 }
  21.                 else
  22.                 {
  23.                     result = SearchFromParent(searchFor, Child);
  24.                     if(result!=null)
  25.                     {
  26.                         return result;
  27.                     }
  28.  
  29.                 }
  30.                
  31.                
  32.             }
  33.             return null;
  34.         }
Add Comment
Please, Sign In to add comment