3

How can I add preferences to the browser so it launches without javascript?

1

2 Answers 2

5

Try setting firefox's profile to disable the javascript:

from selenium import webdriver

fp = webdriver.FirefoxProfile()

fp.set_preference("browser.download.folderList",2)
fp.set_preference("javascript.enabled", False)

browser = webdriver.Firefox(firefox_profile=fp)

To check in the webdriver browser if javascript is enabled do the following:

On the menubar navigate to Firefox > Preferences > Content and the check button for enable javascript should be unchecked. Like the picture shown below.

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

It doesn't work. If you check about:config in your selenium driven Firefox instance, it still shows javascript.enabled true, and it executes javascript code.
0

You can disable javascript directly from the browser. Steps:

  • Type About:config in url
  • Click I'll be careful, I promise
  • Search for javascript.enabled
  • Right click -> Toggle
  • Value = false

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.