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
  • 19,228
  • 5
  • 29
  • 49
  • 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
  • Welcome to Stack Overflow! See: [How do I do X?](https://meta.stackoverflow.com/questions/253069/whats-the-appropriate-new-current-close-reason-for-how-do-i-do-x) The expectation on SO is that the user asking a question not only does research to answer their own question but also shares that research, code attempts, and results. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and most of all it helps you get a more specific and relevant answer! See also: [ask] – JeffC May 06 '18 at 23:35
  • 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
  • 547
  • 7
  • 18