Home » Java » Disable css rendering in chrome driver using selenium, java

Disable css rendering in chrome driver using selenium, java

Posted by: admin July 15, 2018 Leave a comment

Questions:

I want to disable CSS in Selenium with Chrome driver. My code looks like this

System.setProperty("webdriver.chrome.driver", "Path to chrome driver");

Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("profile.managed_default_content_settings.images", 2);

options.setExperimentalOption("prefs", prefs);

ChromeDriver driver = new ChromeDriver(options);
driver.get("https://www.sampleurl.com/);

I googled it. But I can’t get the perfect solution to disable CSS.

Answers: