Added TryRetryFindToast helper

This commit is contained in:
2025-11-08 11:14:09 +01:00
parent 545f9bd81c
commit 3fd16114c9
2 changed files with 33 additions and 14 deletions

View File

@@ -65,4 +65,35 @@ public static class AppHelper
submit.Click();
Thread.Sleep(250);
}
public static bool TryRetryFindToast(ChromeDriver driver)
{
int retryCounter = 0;
retry:
try
{
IWebElement successToast = driver.FindElement(By.CssSelector("#toastContainer div.bg-success"));
if (successToast.Displayed)
{
return true;
}
}
catch (Exception) { }
try
{
IWebElement failToast = driver.FindElement(By.CssSelector("#toastContainer div.bg-danger"));
if (failToast.Displayed)
{
return false;
}
}
catch (Exception) { }
if (++retryCounter < 5)
{
Thread.Sleep(250);
goto retry;
}
return false;
}
}