public static void ClearWrapper(this IWebElement element, ExtentReportsHelper extentReportsHelper, string elementName) { element.Clear(); if (element.Text.Equals(string.Empty)) { extentReportsHelper.SetStepStatusPass($"Cleared element [{elementName}] content."); } else { extentReportsHelper.SetStepStatusWarning($"Element [{elementName}] content is not cleared. Element value is [{element.Text}]"); } }
public static bool ValidatePageTitle(this IWebDriver driver, ExtentReportsHelper extentReportsHelper, string title, uint timeoutInSeconds = 300) { bool result = false; var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(timeoutInSeconds)); wait.IgnoreExceptionTypes(typeof(Exception)); return(result = wait.Until(drv => { if (drv.Title.Contains(title)) { extentReportsHelper.SetStepStatusPass($"Page title [{drv.Title}] contains [{title}]."); return true; } extentReportsHelper.SetStepStatusWarning($"Page title [{drv.Title}] does not contain [{title}]."); return false; })); }
public static bool ElementlIsClickable(this IWebElement element, IWebDriver driver, ExtentReportsHelper extentReportsHelper, string elementName, uint timeoutInSeconds = 60, bool displayed = true) { try { WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(timeoutInSeconds)); return(wait.Until(drv => { if (WaitHelpers.ExpectedConditions.ElementToBeClickable(element) != null) { extentReportsHelper.SetStepStatusPass($"Element [{elementName}] is clickable."); return true; } extentReportsHelper.SetStepStatusWarning($"Element [{elementName}] is not clickable."); return false; })); } catch { return(false); } }