public static void waitForOneTrust()
{
var stopwatch = new Stopwatch();
stopwatch.Start();
while (stopwatch.Elapsed < TimeSpan.FromSeconds(30))
{
IWebElement oneTrust = driver.FindElement(By.Id("onetrust-accept-btn-handler"));
if (oneTrust.Displayed)
{
break;
}
}
}
In Java:
public void waitTillBackOfficePageLoad()
{
LocalDateTime now = LocalDateTime.now();
while (LocalDateTime.now().isBefore(now.plusSeconds(30)))
{
if(xxxxxx)
{
break;
}
}
}