Skip to content

Instantly share code, notes, and snippets.

@elgatov
Created May 28, 2019 21:30
Show Gist options
  • Save elgatov/d3ed3ab02e68cce03d2a664a56470ac6 to your computer and use it in GitHub Desktop.
Save elgatov/d3ed3ab02e68cce03d2a664a56470ac6 to your computer and use it in GitHub Desktop.
public static IWebElement RetryingFindElement(this IWebDriver driver, By locator)
{
//WebDriverWait WaitElement = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
WebDriverWait WaitElement = new EventFiringWebDriverWait(driver, TimeSpan.FromSeconds(10));
return WaitElement.Until(d =>
{
WaitSpinner(driver);
var e = d.FindElement(locator);
return (e.Displayed ? e : null);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment