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 body of the script is attached as a file to this article. Our wiki has more information on using pre-run executables with tests, as well as more information on using Sauce Storage and other locations for hosting test assets.