10

How to prevent firefox showing the safe mode dialog after the crash? enter image description here

It blocks the automatic selenium tests.

mmm
  • 1,618
  • 16
  • 32

4 Answers4

14

I have no idea how you got this and what your testing flow is. So I can't reproduce and test the solution. But Firefox Safe Mode can be disabled by setting the key toolkit.startup.max_resumed_crashes in about:config to -1.

Here's how to start Firefox with that preference set in C# binding:

FirefoxProfile profile = new FirefoxProfile();
profile.SetPreference("toolkit.startup.max_resumed_crashes", "-1");

IWebDriver driver = new FirefoxDriver(profile);
serv-inc
  • 32,612
  • 9
  • 143
  • 165
Yi Zeng
  • 30,504
  • 12
  • 92
  • 119
4

Since Firefox 23, you can also use the environment variable MOZ_DISABLE_AUTO_SAFE_MODE to disable this dialog and the automatic safe mode.

mmm
  • 1,618
  • 16
  • 32
0

Did you take a look at the configuration options in about:config, there are options for safebrowsing which might be useful.

Bhaskar
  • 554
  • 2
  • 10
0

The solution by @mmm worked until the recent Tor Browser Bundle (which uses Firefox).

If you need an alternative, you can always delete the line

user_pref("toolkit.startup.recent_crashes", 4);

from prefs.js, for example like

sed -i '/toolkit\.startup\.recent_crashes/d' /path/to/prefs.js

or call this as

os.system("sed -i '/toolkit\.startup\.recent_crashes/d' " +
           os.path.join('/path/to' + 'prefs.js"))
serv-inc
  • 32,612
  • 9
  • 143
  • 165