public static IWebDriver WaitForAngular(this IWebDriver driver) { if (driver == null) { throw new ArgumentNullException("driver"); } new WebDriverWait(driver, DefaultWaitTimeSpan).Until <bool>(d => WebDriverExtensions.ExecuteScript <bool>(d, "return !!(window.jQuery && window.ng && $('*[ng-version]').length)", new object[0])); return(driver); }
public static IWebDriver WaitForPageLoad(this IWebDriver driver) { if (driver == null) { throw new ArgumentNullException("driver"); } new WebDriverWait(driver, DefaultWaitTimeSpan).Until <bool>(d => WebDriverExtensions.ExecuteScript <string>(d, "return document.readyState", new object[0]).Equals("complete")); return(driver); }
public void ShouldThrowExceptionWhenExecutingScriptThatExpectsValueWithNullDriver() { // Given // When Action action = () => WebDriverExtensions.ExecuteScript <object>(null, null); // Then var ex = Assert.Throws <ArgumentNullException>(action); Assert.Equal("driver", ex.ParamName); }
public static IWebDriver ScrollToElement(this IWebDriver driver, string cssSelector) { if (driver == null) { throw new ArgumentNullException("driver"); } if (string.IsNullOrWhiteSpace(cssSelector)) { throw new ArgumentNullException("cssSelector"); } WebDriverExtensions.ExecuteScript(driver, $"$('{cssSelector}')[0].scrollIntoView();", new object[0]); return(driver); }