11

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

It blocks the automatic selenium tests.

mmm
  • 1,688
  • 16
  • 35

4 Answers4

15

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
  • 35,772
  • 9
  • 166
  • 188
Yi Zeng
  • 32,020
  • 13
  • 97
  • 125
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,688
  • 16
  • 35
0

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

Bhaskar
  • 594
  • 2
  • 11
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
  • 35,772
  • 9
  • 166
  • 188