コード例 #1
0
        public void Clear()
        {
            WebElement.SendKeys("");
            string messagePassed = $"The (Text Field) [ {ControlName} ] was Clear - CORRECT -.";
            string messageFailed = $"The (Text Field) [ {ControlName} ] was not Clear - WRONG -.";

            ExceptionManager.AssertAreEqual("", WebElement.Text, messagePassed, messageFailed);
        }
コード例 #2
0
        public void ValidateTextFieldValue(string expectedValue)
        {
            string text          = GetValue();
            string messagePassed = $"The (Text Field) [ {ControlName} ] contains the CORRECT value: [ {expectedValue} ].";
            string messageFailed = $"The (Text Field) [ {ControlName} ] contains the WRONG value: [ {text} ], when it should contain the expected value: [ {expectedValue} ].";

            ExceptionManager.AssertAreEqual(expectedValue, text, messagePassed, messageFailed);
        }
コード例 #3
0
        public void ValidateSpan(string expectedValue)
        {
            string text = WebElement.Text;

            string messagePassed = $"The (Span) [ {ControlName} ] contains the CORRECT value: [ {expectedValue} ]";
            string messageFailed = $"The (Span) [ {ControlName} ] contains the WRONG value: [ {text} ], when it should contain the expected value: [ {expectedValue} ]";

            ExceptionManager.AssertAreEqual(expectedValue, text, messagePassed, messageFailed);
        }
コード例 #4
0
        /// <summary>
        /// Validate that text of a hyperlink
        /// </summary>
        /// <param name="expectedValue"></param>
        public void ValidateLinkTextValue(string expectedValue)
        {
            var actualText = WebElement.Text;

            string messagePassed = $"The (Hyperlink) [ {ControlName} ] contains the CORRECT value: [ {expectedValue} ]";
            string messageFailed = $"The (Hyperlink) [ {ControlName} ] contains the WRONG value: [ {actualText} ], when it should contain the expected value: [ {expectedValue} ]";

            ExceptionManager.AssertAreEqual(expectedValue, actualText, messagePassed, messageFailed);
        }
コード例 #5
0
        public static void HandlerModalDialogsAndValidateText(string expectedMessage)
        {
            try
            {
                WaitForAlert(GetWebDriver);

                var alert        = GetWebDriver.SwitchTo().Alert();
                var alertMessage = alert.Text;

                var messageFailed =
                    "The information message in Handler Modal dialog is not the expected [" + expectedMessage + "].";
                var messagePassed =
                    "The information message in Handler Modal dialog is correct.";
                ExceptionManager.AssertAreEqual(alertMessage, expectedMessage, messagePassed, messageFailed);

                alert.Accept();
                BrowserSleep();
            }
            catch (Exception)
            {
                SwitchToDefaultContent();
            }
        }