public void Validate_Add_Service() { test = extent.StartTest("Starting Add Service test"); ServiceListing service = new ServiceListing(); string PageTitle = service.AddService(); Global.GlobalDefinitions.wait(5000); try { string Expected = "Manage Listings"; WebDriverWait wait = new WebDriverWait(Global.GlobalDefinitions.driver, TimeSpan.FromSeconds(10)); wait.Until(ExpectedConditions.ElementExists((By.XPath("//h2[contains(text(),'Manage Listings')]")))); Assert.AreEqual(Expected, Global.GlobalDefinitions.driver.FindElement(By.XPath("//h2[contains(text(),'Manage Listings')]")).Text); Global.Base.test.Log(LogStatus.Pass, "Service is added successfully"); } catch (Exception e) { Global.Base.test.Log(LogStatus.Fail, "Service is not added" + e); } }