Possible Duplicate:
selenium 2.4.0, how to check for presence of an alert
I am using the following code to close the alert window :
Alert alert3 = driver.switchTo().alert();
alert3.dismiss();
The alert appears a few seconds after the opening of the main window.
How can I wait and check if alert appears ?