Search code examples
selenium-webdrivergoogle-chrome-extensioncodeceptjs

How to Load my unpacked chrome extension using codeceptJS


I am using codeceptJS with webdriverio Selenium standalone server. my problem is how do i load my unpacked chrome extension when i run tests. i’ve been searching for the solution from past 2 days but couldn’t find a solution. all i get is some java code from searches.


Solution

  • first of all thank you very much both of you wOxxOm && Yandimirkin Vladislav

    what i did was added few lines into codecept.conf.js

    desiredCapabilities: {
                    chromeOptions: {
                      args: [ "--load-extension=D:/Projects/dpl/dist", "--disable-gpu", "--window-size=1366,768" ]
                    }
                  }

    Here is what codecept.conf.js looks like now:

        exports.config = {
          tests: './*_test.js',
          output: './output',
          helpers: {
            WebDriver: {
              url: 'http://localhost',
              browser: 'chrome',
              desiredCapabilities: {
                chromeOptions: {
                  args: [ "--load-extension=D:/Projects/dpl/dist", "--disable-gpu", "--window-size=1366,768" ]
                }
              }
            },
            ResembleHelper : {
              require: "codeceptjs-resemblehelper",
              screenshotFolder : "./tests/output/",
              baseFolder: "./tests/screenshots/base/",
              diffFolder: "./tests/screenshots/diff/"
            }
          },
          plugins: {
            wdio: {
              enabled: true,
              services: ['selenium-standalone']
            }
          },
          include: {},
          bootstrap: null,
          mocha: {},
          name: 'codecept'
        }