I am trying to run chrome driver without loading any images for obvious reasons.
i found a piece of code online but i think it's outdated
HashMap<String, Object> images = new HashMap<String, Object>();
images.put("images", 2);
HashMap<String, Object> prefs = new HashMap<String, Object>();
prefs.put("profile.default_content_settings", images);
ChromeOptions options =new ChromeOptions();
options.setExperimentalOption("prefs", prefs);
DesiredCapabilities chromeCaps = DesiredCapabilities.chrome();
chromeCaps.setCapability(ChromeOptions.CAPABILITY, options);
driver = new ChromeDriver(chromeCaps);
does not work at all..
any help would be greatly appriciated
With Selenium 4 alpha 1, you can also use CDP for filtering URL's:
In the next Alpha version, the interface will be MUCH more user friendly.
Maven dependency:
This should disable images for you.
new ChromeDriver(DesiredCapabilities) is deprecated.
Check this code,
I found a small plugin that does a really good job
if anyone else is interested, you can grab it here