I am wondering how do I disable javascript when using selenium so I can test server side validation.
I found this article but I don\'t know what to really do. Like I
I was trying to solve this problem and found this blog but the first post has a link that is no longer valid. But I finally found the code to place inside the user-extensions.js that works. Here it is:
Selenium.prototype.doDisableJavascript = function() {
setJavascriptPref(false);
};
Selenium.prototype.doEnableJavascript = function() {
setJavascriptPref(true);
};
function setJavascriptPref(bool) {
prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref("javascript.enabled", bool);
}
Hope this save the time it took me to find it.