Is it possible to pause before automatically accepting alerts?

I have set autoAcceptAlerts capability to my tests, but there are some alerts that I need to check for their text. Currently I’m doing it like this:

String asdf = driver.switchTo().alert().getText();
Assertions.assertTrue(asdf.contains("Unable to login"));

But this sometime passes, and sometimes not, because I get “An attempt was made to operate on a modal dialog when one was not open”

Is there a way to make a small pause before the alert is automatically accepted?

Um, that capability is not documented - what driver are you using zorg?

I saw a way recently of registering a lambda for alerts on a blog post by Keith Harrison Does that help?