Comments (11)
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.
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.
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.
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.
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.
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.
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.
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.
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.
Original comment by [email protected]
on 13 Mar 2013 at 11:45
- Changed state: Closed
from chromedriver.
Original comment by [email protected]
on 21 Feb 2015 at 12:27
- Changed state: Fixed
from chromedriver.
Related Issues (20)
- Standardise CSS colours to RGBA HOT 6
- how can we not wait for the page has finished loading can continue to execute code after click() method HOT 4
- Can no long pass extensions as Base64 encoder CRX files. HOT 3
- Unexpected error. System.Object when using ImplicitlyWait HOT 4
- Finding element by compound CSS selector fails HOT 6
- SendKeys is slow HOT 7
- Java bindings are slow on linux HOT 5
- Headers names (at least for content-length) are interpreted as case-sensitive HOT 6
- Can't access gmail. HOT 4
- Disable popup blocking by default HOT 7
- Update ChromeOptions to include new ChromeDriver capabilities HOT 13
- close() on Chrome Web Driver causes pipe & channel errors HOT 8
- Chrome webdriver hangs (not reponding to check elements with css location HOT 5
- Chrome webdriver hangs (not reponding to check elements with css location) HOT 1
- ChromeDriver calls to Close() or Quit() crash ChromeDriver.exe HOT 22
- Incorrect rect objects are used in Session::GetClickableLocation method HOT 3
- running javascript crashes chromedriver HOT 5
- chromedriver throwing error for collections(find_elements) Selenium::WebDriver::Error::UnknownError: findElements HOT 28
- Chromedriver.exe stays running and leaves behind scoped_dir HOT 12
- chrome.prefs capability works unreliably
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chromedriver.