Этот код отключит все javascript в селене chrome:
@Test() public void Chrome_javascript_disable() throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\AnkitP\\Desktop\\Selenium\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
Map < String, Object > prefs = new HashMap < String, Object > ();
prefs.put("profile.managed_default_content_settings.javascript", 2);
options.setExperimentalOption("prefs", prefs);
WebDriver driver = new ChromeDriver(options);
driver.get("https://www.google.com/imghp");
driver.findElement(By.name("q")).sendKeys("flowers");
driver.findElement(By.className("Tg7LZd")).click();
Thread.sleep(5000);
driver.quit();