When I first had this problem, I tried some different solutions (all wrong):
1. Use Sikuli to handle the modal dialog. When I did this, selenium crashed with the same error I had before:
org.openqa.selenium.UnhandledAlertException: Modal dialog present
2. Catch the error with a Try/Catch clause. For some reason, I couldn't catch the error, neither using the specific 'UnhandledAlertException' nor using a generic Exception.
So, the correct way to access these modal dialogs is the following:
Alert alert = driver.switchto().alert();
This simple piece of code will help you with the annoying modal dialog for some pages.