Skip to content

Instantly share code, notes, and snippets.

@andyli
Created January 30, 2017 08:42
Show Gist options
  • Save andyli/948045e8f9d7b28104c2e2751d77d04a to your computer and use it in GitHub Desktop.
Save andyli/948045e8f9d7b28104c2e2751d77d04a to your computer and use it in GitHub Desktop.
Sauce Labs: How to hide "Stop running this script?" dialogs

Here is the original document written in https://support.saucelabs.com/customer/portal/articles/2057026-how-to-hide-%22stop-running-this-script-%22-dialogs:

How to hide "Stop running this script?" dialogs

In your automated tests for Internet Explorer, you may encounter a dialog with “Stop running this script? A script on this page is causing your web browser to run slowly. If it continues to run, your computer might become unresponsive.”

This means that the browser has detected that some JavaScript may be causing slow behavior.

Since an end user is likely to see this message as well, Sauce Labs is committed to displaying the warning during the test - perhaps your team would like to investigate the behavior of your scripts.

However, if the message is interrupting your automated tests and you wish to disregard it, the following pre-run executable should help to hide it. The pre-run executable will edit the registry of the Windows VM by setting a key called “MaxScriptStatements” to the maximum value, which should prevent the dialog from displaying:

@echo off

reg add "HKCU\Software\Microsoft\Internet Explorer\Styles" /f
reg add "HKCU\Software\Microsoft\Internet Explorer\Styles" /v "MaxScriptStatements" /t REG_DWORD /d 0xFFFFFFFF /f

To use the pre-run executable in your test, simply set the "prerun" desired capability to a public URL or Sauce Temporary Storage URL where the script has been uploaded. The file can be found as an attachment to this post.

Happy testing!

Further reading:

@echo off
reg add "HKCU\Software\Microsoft\Internet Explorer\Styles" /f
reg add "HKCU\Software\Microsoft\Internet Explorer\Styles" /v "MaxScriptStatements" /t REG_DWORD /d 0xFFFFFFFF /f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment