chrome capabilities

143 views
Skip to first unread message

lgr...@gmail.com

unread,
Jul 26, 2016, 11:13:38 AM7/26/16
to Selenium Remote Driver
Hello,

I'm trying to set up chrome capabilities with webdriver

- 'applicationCacheEnabled'  => 'false',
- 'download.default_directory'  => 'C:\\temp\\downloads'

I have tried these parameters in the two constructors Selenium::Chrome, and Selenium::Remote::Driver, but it does not work
could you give me a working example to add this kind of capabilities ?
some links to specific documentation ?

thank you
regards


Daniel Gempesaw

unread,
Jul 27, 2016, 3:21:08 PM7/27/16
to Selenium Remote Driver
Hi,

Unfortunately we only have one example of this in the docs, and there's only an example, no description, but it's at the end of the [docs for the new](https://metacpan.org/pod/Selenium::Remote::Driver#new) function. If those are preferences, one way to do it would be the following:

```
my $driver = Selenium::Remote::Driver->new(
    'browser_name' =>'chrome',
    'extra_capabilities' => {
        'chromeOptions' => {
            'prefs' => {
                'applicationCacheEnabled' => 'false',
                'download.default_directory' => '/private/tmp/whee'
            }
        }
    }
);

```
Starting up the S::R::D like this, I can view the settings of the browser and [see the appropriate download directory](http://take.ms/TKKJv).

I'm not sure if `applicationCacheEnabled` works [as you'd expect for Chromedriver](https://bugs.chromium.org/p/chromedriver/issues/detail?id=47#c2), but you probably know more about that capability than I do. 

You can also pass command line arguments to the chromedriver executable in a similar fashion: use an `args` key in the `chromeOptions` hash:

```
my $driver = Selenium::Remote::Driver->new(
    'browser_name' =>'chrome',
    'extra_capabilities' => {
        'chromeOptions' => {
            'args'  => [
                'window-size=1260,960',
                'incognito'
            ]
        }
    }
);
```

some links I happened upon while googling:

https://www.chromium.org/user-experience/user-data-directory - to see your existing chrome Preferences file
http://peter.sh/experiments/chromium-command-line-switches/ - automatically generated list of chromium command line arguments

HTH, good luck.

lgr...@gmail.com

unread,
Aug 5, 2016, 8:10:00 AM8/5/16
to Selenium Remote Driver
Very good !!!!!!!

Thanks you your help

Reply all
Reply to author
Forward
0 new messages