Example #1
0
        /// <summary>
        /// AssertPageTitle verify page title macth
        /// </summary>
        /// <param name="driver"></param>
        /// <param name="reporter"></param>
        /// <param name="pageTitle"></param>
        public static void AssertPageTitle(RemoteWebDriver driver, Iteration reporter, string pTitle = "")
        {
            reporter.Add(new Act("Waiting for page title"));

            Selenide.WaitForTitle(driver, pTitle);
            string title = Selenide.GetTitle(driver);

            //title = title.Replace("'", "");
            if (!title.ToLower().Contains(pTitle.ToLower()))
            {
                reporter.Add(new Act("Asserting current page title"));
                throw new Exception(string.Format(@"Page Title not matched: Expected Title: ""{0}"" <br> Current Page Title: ""{1}""", pTitle, title));
            }
            else
            {
                reporter.Add(new Act("Asserted current page title : " + title));
            }
        }