0

I have a program that tests some of our sites with javascript disabled. It worked well, until we updated from WebDriver 2.4.5 to the latest. Now I get this error:

java.lang.IllegalArgumentException: Preference javascript.enabled may not be overridden: frozen value=true, requested value=false

It looks like the argument to disable JS is no longer allowed. I can't downgrade the WebDriver because the earlier versions don't work correctly with our updated Firefox.

What are my options for testing with JS disabled? I know Chrome never worked before, and now Firefox doesn't. I tried searching for "webdriver js disabled" but the results just bring back the javascript.enabled, false argument that no longer seems to work.

1
  • I just tried using HTMLUnit with js disabled. And it works, however screenshots are not possible with it since it doesn't render anything (and I need to be able to take screenshots) Commented Aug 29, 2015 at 16:24

1 Answer 1

1

Best I could come up with is;

Create a new Firefox profile called NoJs by starting it with -P

Go to about:config and disable javascript there

Use this profile in selenium

ProfilesIni allProfiles = new ProfilesIni();
FirefoxProfile profile = allProfiles.getProfile("NoJs");

WebDriver driver = new FirefoxDriver(profile);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.