public void CheckSpinner() { Thread.Sleep(5000); PageFactory.InitElements(Initialize.Driver, this); Stopwatch watcher = new Stopwatch(); while (Spinner.IsDisplayed("Spinner")) { Thread.Sleep(5000); watcher.Start(); if (!Spinner.IsDisplayed("Spinner") || watcher.Elapsed.TotalMinutes > 5) { if (watcher.Elapsed.TotalMinutes > 5) { BusinessFlows.ErrorMessage = "Result Could Not Load After 5 Minutes"; logger.Warn("Result Could Not Load After 5 Minutes"); } watcher.Stop(); break; } } }