Search code examples
javascriptgoogle-chromeseleniumwebdriver-iochrome-web-driver

WebDriverIO Selenium pass command line arguments into Chrome from config.js file


I need chrome to run with disable-web-security flag for my UI tests. How can I inject any commands using wdio.config file (http://webdriver.io/).

  capabilities: [{
        browserName: 'chrome'
    }]

Solution

  • You can set any chrome flags within the desired capabilities using goog:chromeOptions

    capabilities: [{
        browserName: 'chrome',
        'goog:chromeOptions': {
            args: ['disable-web-security']
        }
    }]
    

    Check out the chromedriver docs for more information on the chromeOptions object.