/// <summary> /// Waits for a <see cref="List{T}"/>/<<see cref="IWebElement"/>/> to be visible in the page /// </summary> /// <param name="locator">The <see cref="List"/>/<<see cref="By"/>/> locators of the <see cref="IWebElement"/>s</param> /// <param name="maxWaitTimeInSeconds">Maximum amount of seconds as <see cref="int"/> to wait for the <see cref="IWebElement"/> to become visible</param> /// <returns><see langword="true"/> if the <see cref="IWebElement"/> is visible; otherwise, <see langword="false"/></returns> public static bool WaitUntilVisible(this ISearchContext iSearchContext, List <By> locators, int maxWaitTimeInSeconds = GlobalConstants.MaxWaitTimeInSeconds) { var failedLocs = new List <By>(); foreach (var loc in locators) { if (!iSearchContext.WaitUntil(ExpectedCondition.ElementIsVisible(loc), maxWaitTimeInSeconds)) { failedLocs.Add(loc); } } if (failedLocs.Count == 0) { return(true); } if (failedLocs.Count > 0 && maxWaitTimeInSeconds > 1) { return(iSearchContext.WaitUntilVisible(failedLocs, maxWaitTimeInSeconds / 2)); } if (failedLocs.Count > 0 && maxWaitTimeInSeconds <= 1) { return(false); } return(true); }
/// <summary> /// Waits for a <see cref="IWebElement"/> to be visible in the page /// </summary> /// <param name="locator">The <see cref="By"/> locator of the <see cref="IWebElement"/></param> /// <param name="maxWaitTimeInSeconds">Maximum amount of seconds as <see cref="int"/> to wait for the <see cref="IWebElement"/> to become visible</param> /// <returns><see langword="true"/> if the <see cref="IWebElement"/> is visible; otherwise, <see langword="false"/></returns> public static bool WaitUntilVisible(this ISearchContext iSearchContext, By locator, int maxWaitTimeInSeconds = GlobalConstants.MaxWaitTimeInSeconds) { return(iSearchContext.WaitUntil(ExpectedCondition.ElementIsVisible(locator), maxWaitTimeInSeconds)); }