In Firefox, when clicking on a button inside an iframe which opens a confirmation dialog with Opt.AcceptModalDialog() specified, the dialog is not dismissed (accepted or canceled) and one of the following exceptions is thrown:
This seems to be caused by the following code in SeleniumWebDriver.AcceptModalDialog:
The synchronization causes a call to SeleniumWindowManager containing a Firefox workaround:
Catching the exception using a try/catch block in the code above does not work, as the alert is dismissed when the UnhandledAlertException is thrown. Also, the context does not switch to the outermost frame.
An overload to SeleniumWindowManager.SwitchToWindow could be introduced in Coypu, which only synchronizes the window without making sure that the DefaultContent is in scope (not performing the Firefox workaround). This method should then somehow be called by SeleniumWebDriver.AcceptModalDialog & SeleniumWebDriver.CancelModalDialog.