public String getTextByControlName(String textboxname) { var edit = win.GetMultiple(SearchCriteria.ByControlType(ControlType.Edit)); foreach (TextBox t in edit) { if (t.NameMatches(textboxname)) { win.WaitTill(delegate() { Console.WriteLine("*****calling delegate****"); return(t.Enabled); }); return(t.Text); } } return(null); }