There is no default way to wait for a warning.
but you can write your own method something like this.
waitForAlert(WebDriver driver) { int i=0; while(i++<5) { try { Alert alert = driver.switchTo().alert(); break; } catch(NoAlertPresentException e) { Thread.sleep(1000); continue; } } }
source share