Skip to content

Instantly share code, notes, and snippets.

@elgatov
Created September 23, 2018 14:55
Show Gist options
  • Save elgatov/479730a7d529ed77395ca82c85ebd20e to your computer and use it in GitHub Desktop.
Save elgatov/479730a7d529ed77395ca82c85ebd20e to your computer and use it in GitHub Desktop.
static void _FindingElement(object sender, FindElementEventArgs e)
{
wait.Timeout = TimeSpan.FromSeconds(30);
wait.PollingInterval = TimeSpan.FromMilliseconds(500);
wait.IgnoreExceptionTypes(typeof(NoSuchElementException));
wait.Message = "El Spinner ha tardado demasiado en cargar";
wait.Until(d =>
{
bool bool1, bool2, bool3;
var result1 = ((IJavaScriptExecutor)d).ExecuteScript("return document.readyState");
bool1 = result1.Equals("interactive") || result1.Equals("complete");
bool2 = (bool)((IJavaScriptExecutor)d).ExecuteScript("return !!window.jQuery || jQuery.active === 0");
return bool1 && bool2;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment