Пример #1
0
        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 SubmitForm(this IElementContainer container, Constraint findBy)
        {
            var element = container.Form(findBy);

            if (element.Exists)
            {
                element.Submit();
            }

            return(container);
        }
Пример #3
0
 /// <summary>
 /// Gets the form by action start.
 /// </summary>
 /// <param name="element">The element.</param>
 /// <param name="action">The action.</param>
 /// <returns></returns>
 public static Form GetFormByActionStart(this IElementContainer element, string action)
 {
     return(element.Form(Find.ByElement(e => e.GetAttributeValue("action") != null && e.GetAttributeValue("action").StartsWith(action))));
 }
Пример #4
0
 /// <summary>
 /// Gets the form by action.
 /// </summary>
 /// <param name="element">The element.</param>
 /// <param name="action">The action.</param>
 /// <returns></returns>
 public static Form GetFormByAction(this IElementContainer element, string action)
 {
     return(element.Form(Find.ByElement(e => e.GetAttributeValue("action") == action)));
 }