Home > Software engineering >  How to disable JavaScript setting in Microsoft Egde using Selenium/Java?
How to disable JavaScript setting in Microsoft Egde using Selenium/Java?

Time:08-11

I've tried to use this one to solve this problem, but it doesn't disable javascript setting in the Microsoft Edge browser. Could someone help with this? Thanks!

EdgeOptions options = new EdgeOptions();

options.setCapability("javascript.enabled", false);

CodePudding user response:

This code might be of some help:

prefs.put("profile.default_content_setting_values.javascript", 2);
EdgeOptions options = new EdgeOptions();
options.setExperimentalOption("prefs", prefs);
WebDriver driver = new EdgeDriver(options);
driver.get("site url");
  • Related