Created
September 19, 2018 16:46
-
-
Save safestudent/dd5de704eb6f54893edc554b6652205b to your computer and use it in GitHub Desktop.
Wait for Element
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IWebElement WaitForElement(By locator) | |
{ | |
// Here we set the timeout as 5 second, 0 minutes and 0 hours | |
WebDriverWait wait = new WebDriverWait(Browser, new TimeSpan(0, 0, 5)); | |
// Here we set the `Until` condition as until the browser finds the element. If it find the element in 5 seconds, it will return it. | |
return wait.Until(Browser => Browser.FindElement(locator)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment