I've seen (and actually answered) several selenium-specific questions where there is a need to set some particular browser preference to change it's behavior, for example:
In other words, there are tons of questions which can be grouped in two types:
This is usually done via setting/configuring:
FirefoxProfile
for FirefoxChromeOptions
for ChromeDesiredCapabilities
for Internet ExplorerWhat is a preferred and most efficient strategy to find browser-specific solutions for a particular problem? Is there a mapping between preferences across major browsers?
For example, I've found out that to disable cache in Firefox, I can set browser.cache.disk.enable
, browser.cache.memory.enable
, browser.cache.offline.enable
and
network.http.use-cache
preferences to false
. How can I know how to do the same in Chrome and IE?
Summary: Selenium Chrome Options class is used to manipulate various properties of Chrome driver. Desired Chrome Capabilities class provides a set of key-value pairs to modify individual properties of web driver such as browser name, browser platform, etc.
ChromeOptions is another class that can be used in conjunction with Desired Capabilities in Selenium WebDriver for Chrome to customize or manipulate the various properties of Chrome browser.
The setCapability method of the DesiredCapabilities Class, which is explained in the later part of the tutorial, can be used in Selenium Grid. It is used to perform a parallel execution on different machine configurations. It is used to set the browser properties (Ex. Chrome, IE), Platform Name (Ex.
To highlight what I mean will crunch down Wikipedia article to 1 sentence :
Selenium WebDriver ... is implemented through a browser-specific browser driver, which ... aims to provide a basic set of building blocks from which developers can create their own Domain Specific Language.
Rather try to think it this way: If particular browser implements a feature then there is a good chance that selenium driver exposes it. You know if feature is implemented if you can solve it manually.
I decently effective problem solving algorithm for you: CS || RTM || UTSL
Image is from Jeff Atwood blog post.
No, preferences are not consolidated across drivers. Drivers have their specifics and tradeoffs.
Different browsers or even browser versions support different sets of capabilities. Some of them lack even common things. Some of those features are covered by selenium in order for it to provide basic functionality that it has. Example of this would be older IE does not support xPath and Selenium has to simulate this behavior. You can not make assumption it adds behavior to take account for every quirk in every browser to create a common platform (that would be a wicked problem).
I suggest you read Wicked problem : Strategies to tackle wicked problems.
To do same in chrome you could run chrome driver with --disable-application-cache
argument. To see what flags your current Chrome can set you can browse to chrome://flags/
inside chrome. Alternative way would be to look up available source.
Alternative name for IE would be mother lode of quirks. This is where you need to do research. One way would be to call RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess nr
Where nr is flag field:
This source claims that as of May 2013 IE might have desiredCapabilities.ensureCleanSession to clear cache, however I have not tested it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With