Created
November 11, 2013 11:59
-
-
Save thakurarun/7412165 to your computer and use it in GitHub Desktop.
It finds the first specified type of control in calling method, and return it;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static T FindFirstSelectControlInControl_ExtentionMethod<T>(UITestControl ControlInWhichSelectControlCanBeFound) | |
{ | |
T element = default(T); | |
var childrenControl = ControlInWhichSelectControlCanBeFound.GetChildren(); | |
if (childrenControl.Count > 0) | |
{ | |
childrenControl.All(x => | |
{ | |
if (x is T) | |
{ | |
element = (T)Convert.ChangeType(x, typeof(T)); | |
return false; | |
} | |
else | |
{ | |
element = FindFirstSelectControlInControl_ExtentionMethod<T>(x); | |
if (element != null) return false; | |
return true; | |
} | |
}); | |
} | |
return element; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment