When my test run using a webdriver for Firefox I'll get modal exception after reaching an accept on an alert:
[Exception]: Modal dialog present
The tests however work fine when using IE webdriver. The problem seems to be that test scenario proceeds before the alert is completely closed. In other words it tried to do the following:
List<WebElement> l = driver.findElements(By.linkText("link"));
and a result I'll get modal exception.
Now wait.until(ExpectedConditions)
as mentioned wait.until(ExpectedConditions.visibilityOf Element1 OR Element2) is good candidate. However I am not able to create a condition that returns true when alart disappears. How can I do that?
Edit: to clarify further, the problem is not waiting for the alert to appear (my implicit wait is working fine for that purpose). I do get the alert and apply the test on that however after I click accept on the alert, test goes on fast and tried to proceed with the next step while alert still present and throws the modal present exception. I have also tried the following to prevent that with out success.
driver.switchTo().defaultContent();