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.
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.
Yep - worked for me!
Thanks for investigating @georgecrawford !
If it does work it works only on explicit <img>
tags not CSS-loaded image resources. Am I correct?
Most helpful comment
I haven't tried this, but you might have luck adding the same thing inside a
chromeOptions
block:That's what seems to be implied by https://sites.google.com/a/chromium.org/chromedriver/capabilities.