0

So i have this page that loads the items of a player

and it has

body class="">

A body class, now when I start the website it basically does this

body class="loading">

Now I want to put a 'wait' on my code untill the

body class="loading">

basically goes away and goes back to the empty class

JeffC
  • 22,180
  • 5
  • 32
  • 55
  • Possible duplicate ? https://www.google.it/url?sa=t&source=web&rct=j&url=https://stackoverflow.com/questions/34678267/how-to-implement-a-webdrivereventlistener-in-c&ved=2ahUKEwiBjaCSjfLaAhUHVRQKHW5tCzAQFjAAegQICRAB&usg=AOvVaw0p96ws9OE2NqACLFXCIE8I – JacopoDT May 06 '18 at 22:14
  • @JacopoDT no I'm trying to do a negative wait.till – refactorcoding May 06 '18 at 22:18
  • Possible duplicate of [How can I make sure if some HTML elements are loaded for Selenium + Python?](https://stackoverflow.com/questions/50154940/how-can-i-make-sure-if-some-html-elements-are-loaded-for-selenium-python) – undetected Selenium May 07 '18 at 06:53

1 Answers1

0

maybe this isn't the most elegant solution, it worked for me :

public void AttendreWhileBodyLoading()
{

  var myWait =new WebDriverWait(Driver.Instance, TimeSpan.FromSeconds(5));
  myWait.Until<IWebDriver>((d) =>
  {
    if (Driver.Instance.FindElements(By.ClassName("loading")).Count == 0)
    {
      return driver;
    }
    return null;
  });
}
Carl Verret
  • 576
  • 8
  • 21