I'm trying to find elements on a web page that is created using ASP.NET. The problem is ASP.NET prior to version 4.0 generates some long names for the controls so to find a simple "Username" input field I need to use its full name:
var elementName = "LoginControl1_uxLoginControl_UserName";
var username = Browser.TryFind(By.Name(elementName));
and it seems to be working, but I'm looking for something simpler. Is it possible to do the same thing using partial element names or partial Ids? e.g.
var username = Browser.TryFind(By.CssSelector("UserName"));
this should return all the elements that have "UserName" in their names/ids (or even the first element).