Webdriverio: Opening default browser profile

Created on 15 Oct 2014  ·  7Comments  ·  Source: webdriverio/webdriverio

I'm trying to test a page that uses some browser extensions and plugins. However, the browser instance that Webdriverio opens has all extensions removed by default and my tests fail. In Chrome I've tried passing --user-data-dir to chromeOptions to load the default profile, but while chrome://version/ verifies that the profile loaded, there seem to be a bunch of command line options that override that and my extensions are still gone. In Firefox my extensions are removed and all plugins are set to "Ask to Activate". Is there a workaround for this?

Question Selenium Related

Most helpful comment

if it can help , I could load an extension like that :

desiredCapabilities: {
                    browserName: 'chrome',
                    "chromeOptions": {
                        "args": [
                            "load-extension="+__dirname+"/test/extensions/adblock",
                            "lang=de-DE","window-size=1280,800"]
                    }
                }

the extension path pointing to the uncompressed adblock chrome extension ( which I found in the google OS X application support directory on my machine )

All 7 comments

I've once added a Chrome extension via chromeOptions.extensions. Maybe you could try to encrypt your extensions in base64 and do it the same way. Other than that I've no further experience with extension in Selenium and I've never tried to load an existing user profile. How do you set your desired capabilities?

This affects plugins as well though. For instance, if I want to test that an HTML5 video fallback player is working, it will be disabled by default. I'm just trying to load the default profile, not a separate user profile but it seems that webdriver is setting custom flags to disable plugins and extensions. Any idea how to simply open the browser with default settings?

mhm .. if flags aren't working, I am out of ideas. Never had this use case. Could you explain me your situation a little bit more in detail. I still don't quite understand what's the extension role here?

I suspect this is more of a Selenium issue than a WebdriverIO issue now. But I’ll add a little more info here to be clear.

I would like to test that an HTML5 video polyfill falls back to, say, Flash and features still work correctly if certain conditions are/aren't met. The default profile blocks Flash from loading at all though, so these tests will always fail.

On Oct 27, 2014, at 1:48 PM, Christian Bromann [email protected] wrote:

mhm .. if flags aren't working, I am out of ideas. Never had this use case. Could you explain me your situation a little bit more in detail. I still don't quite understand what's the extension role here?


Reply to this email directly or view it on GitHub.

if it can help , I could load an extension like that :

desiredCapabilities: {
                    browserName: 'chrome',
                    "chromeOptions": {
                        "args": [
                            "load-extension="+__dirname+"/test/extensions/adblock",
                            "lang=de-DE","window-size=1280,800"]
                    }
                }

the extension path pointing to the uncompressed adblock chrome extension ( which I found in the google OS X application support directory on my machine )

For me everything is working. I think this is also affected by a full stack of technologies that you are using. Mine stack is creating a new profile each test execution and delete it after. It's easy to see what's happening just looking the processes while running selenium, it will be variable pathed to selenium-x-x-x.jar .

Closing as this is more an issue of Selenium then WebdriverIO

Was this page helpful?
0 / 5 - 0 ratings