示例#1
0
    public static ReadOnlyCollection <IWebElement> WaitUntilAllEnabled(this IWebDriver driver, string selector, TimeSpan timeout)
    {
        var wait = new WebDriverWait(driver, timeout);

        try
        {
            return(wait.Until(ExpectedConditions.ElementsAreEnabled(By.CssSelector(selector))));
        }
        catch (WebDriverTimeoutException e)
        {
            throw new WebDriverTimeoutException($"Elements with selector '{selector}' were not enabled after {timeout.TotalSeconds} seconds.", e);
        }
    }