Currently, I am utilizing Selenium for web testing using Java programming language. My objective is to disable JavaScript on the Firefox Browser, Google Chrome Browser, and IE Browser.
I have attempted the following code specifically for the Firefox Browser.
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("javascript.enabled", false);
WebDriver driver = new FirefoxDriver(profile);
Unfortunately, an error occurs on the second line as shown below:
Exception in thread "main" java.lang.IllegalArgumentException: Preference javascript.enabled may not be overridden: frozen value=true, requested value=false
If you have any insights on disabling JavaScript when working with Selenium on various browsers, your assistance would be highly appreciated!