module-webdriver icon indicating copy to clipboard operation
module-webdriver copied to clipboard

Loading webdriver tests with specific google chrome profile

Open p-saxena opened this issue 9 years ago • 2 comments

Hi All,

I am trying to execute my codeception/webdriver tests on google chrome with a particular extension enabled. So, I created a new chrome profile. The path is: ~/watchmaster/.config/google-chrome/Profile 2 Now I provided this path in my config yml file as:

modules:
  config:
    WebDriver:
      host: localhost
      port: 4444
      browser: chrome
      window_size: 1024x768
      url: 'xxx'
      capabilities:
        unexpectedAlertBehaviour: 'accept'
        chrome_profile: '/home/watchmaster/.config/google-chrome/Profile 2'
    \Helper\EnvSpecificHelper:
      languageCode: de_DE
      environment: testing-de_DE

But when I execute my tests, it is not loading this profile. I am using codeception v2.1.8 Any pointers how can I achieve loading this specific profile?

Thanks Prateek

p-saxena avatar Aug 26 '16 13:08 p-saxena

@p-saxena, you should be able to do this using the chromeOptions key of WebDriver's desired capabilities. See links below for explanation.

http://codeception.com/docs/modules/WebDriver https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities https://sites.google.com/a/chromium.org/chromedriver/capabilities#TOC-Use-custom-profile-also-called-user-data-directory-

class_name: AcceptanceTester
modules:
  enabled:
    - WebDriver:
        url: localhost
        browser: chrome
        host: localhost
        capabilities:
          chromeOptions:
            args:
              - user-data-dir=/Users/<my-user-name>/Library/Application Support/Google/Chrome

(You'll obviously need to correct the profile path.)

oehlschl avatar Sep 14 '16 20:09 oehlschl

I have the same problem. I used the above code as you mentioned and run command from codection directory as follow: c:\codeception>php codecept.phar run tests/acceptance/my_test_name.php but still doesn't load the required extension. it only loads chrome browser. BTW I am using windows OS

Genene avatar Nov 01 '17 14:11 Genene