Ejemplo n.º 1
0
        /// <summary>
        ///     Verify the right error message was displayed
        /// </summary>
        /// <param name="errorMessage"></param>
        public void AssertErrorMessageWasDisplayed(string errorMessage)
        {
            _webDriverHelpers.WaitUntilElementIsVisible(_driver, By.CssSelector("#content"));
            var searchResult = ErrorEncountedElemet.Text;

            Assert.That(searchResult.Contains(errorMessage), "Friendly Error message was not displayed as expected");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Method performs search on the webpage.
        /// </summary>
        /// <param name="valueToBeSearched"></param>
        public ResultsPage PerformSearchOnWebSite(string valueToBeSearched)
        {
            _webDriverHelpers.WaitForTimeSpan(2000); // Bad coding, we shouldn't have to wait, I need more time to investigate why i am getting element not clickable because of another element obscures it.
            _webDriverHelpers.WaitUntilVisibleAndClick(_driver, By.CssSelector("#icon-search"));
            _webDriverHelpers.WaitUntilElementIsVisible(_driver, By.CssSelector("[name*='keywords']"));

            var firstOrDefaultElement = SearchTextPlaceholderElement.FirstOrDefault(x => x.Text == "");

            if (firstOrDefaultElement == null)
            {
                throw new Exception("SearchTextplaceholder element was null");
            }

            _webDriverHelpers.WaitUntilVisibleAndSendKeys(_driver, firstOrDefaultElement, valueToBeSearched);
            SearchIconWithInThePlaceholderElement.FirstOrDefault()?.Click();

            return(new ResultsPage(_driver, _webDriverHelpers));
        }