Skip to content

webDriver.Quit() hangs if alert is raised in the onbeforeunload event #1563

@zeit200

Description

@zeit200

System

  • Version: 0.24.0
  • Platform: Windows 10 64-bit
  • Firefox: 66.0.2
  • Selenium: C# 3.141.0

Testcase

using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;

namespace Test
{
    internal static class Launcher
    {
        public static void Main()
        {
            var firefoxOptions = new FirefoxOptions { BrowserExecutableLocation = @"..\firefox\firefox.exe" };
            firefoxOptions.SetPreference("dom.disable_beforeunload", false);
            var webDriver = new FirefoxDriver(@"..\geckodriver", firefoxOptions);
            webDriver.Navigate().GoToUrl("https://google.com");
            webDriver.ExecuteScript("window.top.onbeforeunload = function() { return confirm('123'); };");
            webDriver.FindElement(By.TagName("body")).Click();
            webDriver.Quit();
        }
    }
}

webDriver.Quit() never returns

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions