/// <summary> /// Wait until the expected callback DOES NOT throw an exception. /// The callback usually contains one or more assertions. /// </summary> /// <param name="callback"></param> private void AssertThatEventually(Action <IDecoratedWebDriver> callback, string because) { if (null == callback) { throw new ArgumentNullException(nameof(callback)); } DateTime endMatch = DateTime.Now.AddSeconds(_controlSettings.WaitUntilTimeoutInSeconds); Exception lastException = default; do { try { callback(_webDriver); _testCaseReporter.Pass(because); return; } catch (Exception ex) { lastException = ex; } System.Threading.Thread.Sleep(_controlSettings.PollingTimeInMilliseconds); } while (DateTime.Now < endMatch); _testCaseReporter.Fail(because, lastException); throw lastException; }