Wednesday, September 5, 2012

Usual Problem in Firefox under heavy load.

@Problem: [Warning: Unresponsive script] message is being popped out in middle of test execution. Due to this test is getting failed.

@Description: A script on this page may be busy, or it may have stopped responding. You can stop the script now or you can continue to see if the script will complete.




@Why This Message: "[JavaScript] that executes for whole seconds is probably doing something wrong..." says Brendan Eich, creator of JavaScript. When a script is executing, Mozilla's UI will be unresponsive until the script’s thread ends. Correspondingly, Mozilla will alert you when a script is taking a long time to run and let you stop the script. This preference lets you define what "a long time" is.

You can set preference time according to your wish by following below steps:
1) Open Mozilla Firefox browser instance.
2) Type-in in address bar: about:config and press enter.



3) Firefox will give you [This might void your warranty!] message.
4) Click on [I'll be careful, I promise!] button.
5) Then will open preference page. Now type-in in search text box [dom.max] and press enter.



6)You will find two settings as below:
+ dom.max_chrome_script_run_time
+ dom.max_script_run_time
7) Set as you wish the values for wait time.
@Note: The value is a positive integer, determining the number of seconds of execution before warning. 0 and negative values are considered "forever." (Default value is 10; 5 in versions )


Reference

@NOTE: As far as selenium automation is concerned, above settings will not work as every test loads a new browser profile which does only contain basic default setting. Any custom settings will not load. So you have to achieve these settings for your test by writing code as below for appropriate target browser:

            FirefoxProfile profile = new FirefoxProfile();
            profile.setPreference("dom.max_chrome_script_run_time" , "999");
            profile.setPreference("dom.max_script_run_time" , "999");









1 comment: