private void LogIn(IElementContainer browser) { browser.Link(Find.ByName("LoginLink")).Click(); browser.TextField(Find.ById("infoLDAP_E.customerID")).Value = Config.Username; browser.Form("formCustomerID_1").Submit(); if (browser.Elements.Count(el => el.Text == "We are unfamiliar with the computer you are using") != 0) { // Security Question var question = browser.Element(Find.ByText("Question:")).NextSibling.Text; question = question.TrimStart(' ').TrimEnd(' '); browser.TextField("cbQuestionChallenge.responseUser").Value = Config.SecurityAnswers[question]; browser.Element(Find.ByValue("Continue")).Click(); } browser.TextField("authentication.PassCode").Value = Config.Passcode; browser.TextField("authentication.ERN").Value = Config.RegistrationNumber; browser.Form(Find.ByName("hiddenForm")).Submit(); }
public static IElementContainer OnMessage(this IElementContainer container, Constraint findBy, Action <string> action) { var element = container.Element(findBy); if (element.Exists) { action(element.Text); } return(container); }
private static Element FindUntypedElement(IElementContainer container, Constraint constraint) { return(container.Element(constraint)); }
private static Button TryFindCalendareButton(IElementContainer container, string id) { var element = container.Element(Find.ById(id)); return(((IElementContainer)element.Parent).Button(Find.ByClass("CalendarInput"))); }