We're updating the issue view to help you get more done. 

Firefox does not show beforeunload alerts


By default, Firefox does not show alerts triggered by the beforeunload event when running through geckodriver. This behavior sets Firefox apart from other browsers.

The alerts can be forced using the following Firefox profile settings:

This enables an alert shown when closing the browser with "open changes" on the page, which is not closed by our infrastructure after the last test (Coypu.BrowserSession.Dispose() is called, closing the browser which causes the alert, which is not dismissed by Coypu).

Possible workaround:

  • Send a Kill command to the browsers processes, this does not cause them to show alerts.

  • Visit an arbitrary site, causing the alert to show, dismiss it, Dispose the BrowserSession.

The alert is also shown when visiting another test site after having unsaved changes on the current page. It is possible to dismiss the dialog, but for some reason Firefox does not wait for the site to be ready before accessing its dom, this causes parts of the site to be missing when accessed through web tests.

Possible workaround:

  • Wait for the page's document.readyState to be either "interactive" or "complete".

    • This should be done by Selenium, but isn't somehow.

    • In some cases, document.readyState is "complete", but the page is missing the main content.

At the end of some test fixtures, this dialog is shown:

This dialog can’t be dismissed, because it opens during the BrowserSession disposal.


Marcel Holle


Marcel Holle


Time tracking



Fix versions

Affects versions