Giter Club home page Giter Club logo

Comments (11)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 24, 2024
Chrome, at least the current version, does not recognize a "disable-images" 
command-line switch. Did you see this documented somewhere?

Original comment by [email protected] on 24 Feb 2012 at 4:21

from chromedriver.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 24, 2024
Didn't see it documented. I saw references to it while searching the web and 
thought it'd work. Is there any other way to achieve the same outcome?

Original comment by [email protected] on 24 Feb 2012 at 6:06

from chromedriver.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 24, 2024
There's not an easy way to do this currently. Why do you want to disable 
images? Is it for taking a screenshot?

Could you accomplish the same thing by executing a script that adds some CSS 
that hides all img elements? Maybe something like:

var style = document.createElement('style');
style.innerHTML = "img { display: none !important}";
document.head.appendChild(style);

Let me know if this is not sufficient for you.

Original comment by [email protected] on 27 Feb 2012 at 5:22

from chromedriver.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 24, 2024
I was hoping to disable the images in order to decrease the load time of the 
page. Iterating through a bath of domain names, so cutting the loading time 
will speed up the overall process.

Original comment by [email protected] on 27 Feb 2012 at 11:47

from chromedriver.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 24, 2024
I see. There have been a few requests to set arbitrary chrome preferences. 
Disabling images could be handled in the same way. I'll add a 'chrome.prefs' 
capability for a list of chrome preferences to set. You need to set it to 
{'profile.default_content_settings': {'images': 2}}. Chrome preferences change 
over time, so you may have to change this in the future.

Original comment by [email protected] on 28 Feb 2012 at 6:20

  • Changed title: Add support for setting arbitrary Chrome preferences.
  • Changed state: Started
  • Added labels: Priority-Low, Type-Enhancement
  • Removed labels: Priority-Medium, Type-Defect

from chromedriver.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 24, 2024
This has been fixed and should be in ChromeDriver 19.0.1068.0.

Original comment by [email protected] on 14 Mar 2012 at 8:12

  • Changed state: Resolved

from chromedriver.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 24, 2024
Here is an example in Java:

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

Map<String, Object> preferences = new HashMap<String, Object>();
preferences.put("profile.default_content_settings", contentSettings);

DesiredCapabilities caps = DesiredCapabilities.chrome();
caps.setCapability("chrome.prefs", preferences);

Original comment by [email protected] on 14 Dec 2012 at 2:50

from chromedriver.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 24, 2024
For C# using reflection:
            var imageSetting = new Dictionary<string, object>();
            imageSetting.Add("images", 2);
            Dictionary<string, object> content = new Dictionary<string, object>();
            content.Add("profile.default_content_settings", imageSetting);

            var prefs = new Dictionary<string, object>();
            prefs.Add("prefs", content);

            var options = new ChromeOptions();
            var field = options.GetType().GetField("additionalCapabilities", BindingFlags.Instance | BindingFlags.NonPublic);
            if (field != null)
            {
                var dict = field.GetValue(options) as IDictionary<string, object>;
                if (dict != null)
                    dict.Add(ChromeOptions.Capability, prefs);
            }

If you need other ChromeOptions you will need to add them manually using the 
dictionary too. The reflection bit is necessary as ChromeOptions overrides any 
chrome.prefs setting

Original comment by [email protected] on 22 Jan 2013 at 8:04

from chromedriver.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 24, 2024
What would be the proper way to achieve this in python?

Original comment by [email protected] on 3 Feb 2013 at 5:37

from chromedriver.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 24, 2024

Original comment by [email protected] on 13 Mar 2013 at 11:45

  • Changed state: Closed

from chromedriver.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 24, 2024

Original comment by [email protected] on 21 Feb 2015 at 12:27

  • Changed state: Fixed

from chromedriver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.