public static Element LocateLink(this IElementsContainer container, string transition) { //form id FormCollection forms = container.Forms.Filter(Find.ById(transition)); if (!forms.IsEmpty()) { return(forms[0]); } //form class forms = container.Forms.Filter(FindByClassName(transition)); if (!forms.IsEmpty()) { return(forms[0]); } //link id LinkCollection links = container.Links.Filter(Find.ById(transition)); if (!links.IsEmpty()) { return(links[0]); } //link "rel" links = container.Links.Filter(FindByRel(transition)); if (!links.IsEmpty()) { return(links[0]); } //link class links = container.Links.Filter(FindByClassName(transition)); if (!links.IsEmpty()) { return(links[0]); } return(null); }