How to disable JavaScript in browser using Selenium (Java)?

前端 未结 6 1647
抹茶落季
抹茶落季 2020-12-20 08:01

In my feature automation, I need to disable JavaScript in browser and run the flow. How to disable JavaScript?

Tried DesiredCapabilities for firefox and Chrome.

6条回答
  •  醉梦人生
    2020-12-20 08:15

    this works:

    FirefoxOptions options = new FirefoxOptions();
    options.addPreference("javascript.enabled", false);

提交回复
热议问题