Is there a way to disable images in Chromedriver with Javascript ( Node.js )? I couldn\'t find a proper answer to this question anywhere!
I do realise this question is quite old, but still - it is the first Google search result for the node chromedriver disable images
query. So I decided to give it a go anyway.
I don't know the exact setup the OP was trying to use, so I'll refer to my own. I'm using nightwatch.js
with pre-built Selenium running chromedriver
. In my nightwatch.conf.js
file I have the following setup for the chromedriver
:
module.exports = {
"test_settings": {
"default": {
...
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"chromeOptions": {
"args": ["disable-web-security"],
"prefs": {
"profile.managed_default_content_settings.images": 2
}
}
}
}
}
};
The setup above works with
"chromedriver": "^2.21.2",
"selenium-server": "^2.53.0"
and is running Chrome 51.0.2704.84 stable.
I hope that helps someone, as I lost about 3 hours trying to come up with this solution.