Total Pageviews

Friday, 1 March 2019

Disabling images on a webpage using selenium

             
              System.setProperty("webdriver.chrome.driver","./drivers/chromedriver.exe");
Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("profile.default_content_setting_values.images",2);
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", prefs);
WebDriver driver = new ChromeDriver(options);
driver.get("https://www.google.com/");


// we can use different preferences to set browsers  as per our need.
profile.default_content_setting_values.cookies
profile.default_content_setting_values.images
profile.default_content_setting_values.javascript
profile.default_content_setting_values.plugins
profile.default_content_setting_values.popups
profile.default_content_setting_values.geolocation
profile.default_content_setting_values.notifications
profile.default_content_setting_values.auto_select_certificate
profile.default_content_setting_values.fullscreen
profile.default_content_setting_values.mouselock
profile.default_content_setting_values.mixed_script
profile.default_content_setting_values.media_stream
profile.default_content_setting_values.media_stream_mic
profile.default_content_setting_values.media_stream_camera
profile.default_content_setting_values.protocol_handlers
profile.default_content_setting_values.ppapi_broker
profile.default_content_setting_values.automatic_downloads
profile.default_content_setting_values.midi_sysex
profile.default_content_setting_values.push_messaging
profile.default_content_setting_values.ssl_cert_decisions
profile.default_content_setting_values.app_banner
profile.default_content_setting_values.site_engagement

profile.default_content_setting_values.durable_storage

Source: https://chromium.googlesource.com/chromium/src/+/7e762c1f17514a29834506860961ba2f24e7e6e5/components/content_settings/core/common/pref_names.cc

No comments:

Post a Comment