Wait for a modal to disappear in Selenium 2.0
There is now default mechanism to wait for alert to appear/disappear but, we can write our own logic something like below instead of waiting for static amount of time (Thread.sleep(10000)).
waitForAlert(WebDriver driver){ int i=0; while(i++<5) { try { Alert alert = driver.switchTo().alert(); alert.accept(); break; } catch(NoAlertPresentException e) { Thread.sleep(1000); continue; } }}
even I faced this problem in FF and I came over this by using a AUI. Try to use the below code to get your alert > accept it and then continue with rest of your code/test.
Actions action = new Actions (driver);action.click(driver.findElement(By.id("locator"))).build().perform();driver.switchTo().alert().accept();// Continue with your testList<WebElement> l = driver.findElements(By.linkText("link"));