New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable image with chromedriver #1056

Closed
Pylipala opened this Issue Jan 26, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@Pylipala

Pylipala commented Jan 26, 2016

I want to disable image loading for faster page loading, I tried below code, but it does not work:

var webdriverio = require('webdriverio');
var options = {
    desiredCapabilities: {
        browserName: 'chrome',
        'prefs': {
            'profile':{
                'default_content_setting_values': {'images': 2}
            }
        }
    }
};
var client = webdriverio.remote(options)

What is the best way to set browser settings? I know that there is a method to provide a data_dir parameter for browser. I think using data_dir is not very flexible, so I did not even try it.

@georgecrawford

This comment has been minimized.

Show comment
Hide comment
@georgecrawford

georgecrawford Jan 27, 2016

Contributor

I haven't tried this, but you might have luck adding the same thing inside a chromeOptions block:

var options = {
    desiredCapabilities: {
        browserName: 'chrome',
        'chromeOptions': {
            'prefs': {
                'profile':{
                    'default_content_setting_values': {'images': 2}
                }
            }
        }
    }
};

That's what seems to be implied by https://sites.google.com/a/chromium.org/chromedriver/capabilities.

Contributor

georgecrawford commented Jan 27, 2016

I haven't tried this, but you might have luck adding the same thing inside a chromeOptions block:

var options = {
    desiredCapabilities: {
        browserName: 'chrome',
        'chromeOptions': {
            'prefs': {
                'profile':{
                    'default_content_setting_values': {'images': 2}
                }
            }
        }
    }
};

That's what seems to be implied by https://sites.google.com/a/chromium.org/chromedriver/capabilities.

@georgecrawford

This comment has been minimized.

Show comment
Hide comment
@georgecrawford

georgecrawford Jan 27, 2016

Contributor

Yep - worked for me!

Contributor

georgecrawford commented Jan 27, 2016

Yep - worked for me!

@christian-bromann

This comment has been minimized.

Show comment
Hide comment
@christian-bromann

christian-bromann Jan 27, 2016

Member

Thanks for investigating @georgecrawford !

Member

christian-bromann commented Jan 27, 2016

Thanks for investigating @georgecrawford !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment