9

I have a project that sometimes uses multiple FF windows and sometimes multiple FF drivers. During init, I create a custom FirefoxProfile (or load a default from Selenium without any changes), add it to DesiredCapabilities, add capabilities to FirefoxOptions and start FF with FirefoxOptions.

Test case executes fine, until I need to close the window:

driver.getWindowHandles().forEach(name -> driver.switchTo().window(name).close());

or

driver.quit();

After either one of these pass, FF shuts down and "Firefox has crashed" popup appears. No exception is shown in logs.

enter image description here

If I remove FirefoxProfile, no crash popup appears, but FirefoxProfile is needed to enable Flash support and do more.

Using:

  • Selenium 3.4.0
  • Firefox 54 (32 bit)
  • Geckodriver 0.17 (32 bit)
  • Windows 10, 64bit // Windows 7, 64bit
Hans
  • 752
  • 1
  • 15
  • 29
  • I'm not using Geckodriver (I'm working with Selenium 2.5) but I saw many questions and bug reports here and in github on closing the browser. In the meantime [this answer](https://stackoverflow.com/a/40064643/5168011) might provide a temporary patch. – Guy Jul 13 '17 at 07:24
  • @Guy - I can not kill plugincontainer, since i'm using Flash. And if it was a plugin container issue, then it would show, that 'plugin-container.exe has crashed' – Hans Jul 13 '17 at 07:34
  • @Hans looks like it's a know Firefox/geckodriver issue with quitting driver several people have faced and reported on the same issue. Try using FF v47.0.2 which works fine for me as well. – anshul Gupta Jul 17 '17 at 10:29
  • 1
    Why take the time to close all the window handles for the driver if you're just going to call `quit` anyway? I assume this error still occurs if you just called `driver.quit()` correct? – mrfreester Jul 17 '17 at 20:37
  • @mrfreester - There was meant to be OR between those 2 lines of cod actually, but yes, the error occurs also, if I only use `driver.quit()`. – Hans Jul 18 '17 at 05:32
  • 2
    @anshulGupta - I can not use older firefox. Not allowed by upper management and security. – Hans Jul 18 '17 at 05:34

2 Answers2

6

The driver is failing to properly terminate the sub processes created by Firefox like flash.

https://github.com/mozilla/geckodriver/issues/285

To avoid the dialogue box, you can set the environemnt variable XRE_NO_WINDOWS_CRASH_DIALOG to 1.

Florent B.
  • 41,537
  • 7
  • 86
  • 101
3

Yeah the same error happened for me as well. I've tried all possibilities but nothing did works except downgrading the firefox.

Now I've 46.01 which is working for me without crash issue.

  • As stated in my question comments, I can not downgrade FF. Also this is not a fix but a workaround. – Hans Jul 19 '17 at 07:06