enable/disable javascript execution by JS?
Posted: Tue Mar 23, 2010 9:31 am
Hello,
I am using selenium to test my application. I would like to disable javascript execution from within my testcase.
In general I think this little js would solve my problem:
function setJavascriptPref(bool) {
prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref("javascript.enabled", bool);
}
However it seem noscript somehow overrides this setting. Is there anything I can do to activate/deactivate javascript execution with noscript enabled by means of javascript? 'whitelist' seems to be an internal setting that can't be reached via preference-service.
Thx and Greets,
peter
I am using selenium to test my application. I would like to disable javascript execution from within my testcase.
In general I think this little js would solve my problem:
function setJavascriptPref(bool) {
prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref("javascript.enabled", bool);
}
However it seem noscript somehow overrides this setting. Is there anything I can do to activate/deactivate javascript execution with noscript enabled by means of javascript? 'whitelist' seems to be an internal setting that can't be reached via preference-service.
Thx and Greets,
peter