Esempio n. 1
0
 /// <summary>
 /// Waits for an element to be enabled on the page.
 /// It uses ExpectedConditions.WaitForElementUntilCondition
 /// </summary>
 /// <param name="driver">the <see cref="IWebDriver"/></param>
 /// <param name="element">the web element</param>
 /// <param name="elementName">the element name</param>
 /// <param name="page">the page name</param>
 public static void WaitForElementToBeEnabled(IWebDriver driver, IWebElement element, String elementName, String page)
 {
     try
     {
         Func <IWebDriver, Boolean> condition = delegate(IWebDriver d) { return(element.Enabled == true); };
         WaitsHandler.WaitForElementUntilCondition(driver, condition, page);
         LogHandler.Info("WaitForElementToBeEnabled::The element " + elementName + " is enabled on the page " + page);
     }
     catch (Exception e)
     {
         LogHandler.Error("WaitForElementToBeEnabled::Exception - " + e.Message);
         throw new NoSuchElementException("WaitForElementToBeEnabled::The element " + elementName + " is not enabled on the page " + page);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Waits for an element (dropdownlist) to be populated with values.
 /// </summary>
 /// <param name="driver">the <see cref="IWebDriver"/></param>
 /// <param name="element">the web element</param>
 /// <param name="elementName">the element name</param>
 /// <param name="page">the page name</param>
 public static void WaitForElementToBePopulatedWithValues(IWebDriver driver, IWebElement element, String elementName, String page)
 {
     WaitForElementToBeVisible(driver, element, elementName, page);
     try
     {
         SelectElement select = new SelectElement(element);
         Func <IWebDriver, Boolean> condition = delegate(IWebDriver d) { return(select.Options.Count > 1); };
         WaitsHandler.WaitForElementUntilCondition(driver, condition, page);
         LogHandler.Info("WaitForElementToBePopulatedWithValues:: The element " + elementName + " is selected on the page " + page);
     }
     catch (Exception e)
     {
         LogHandler.Error("WaitForElementToBePopulatedWithValues::Exception - " + e.Message);
         throw new NoSuchElementException("WaitForElementToBePopulatedWithValues::The element  " + elementName + " is not selected on the page " + page);
     }
 }