Use Chrome for Testing or Chromium with Axe Watcher

This page is not available in the language you requested. You have been redirected to the English version of the page.
Link to this page copied to clipboard

How to install and configure Chrome for Testing or Chromium for platforms that connect to a system-installed browser

Not for use with personal data

Axe Watcher supports only Google Chrome for Testing or Chromium. Regular Chrome version 139 and later are not supported.

Testing platforms that manage their own browser installation (Playwright and Puppeteer) are not affected; they download a compatible Chromium automatically. Platforms that connect to a browser already installed on the machine (WebdriverIO, WebDriverJS, and Java Selenium) require you to install Chrome for Testing or Chromium and configure its path explicitly.

Install Chrome for Testing or Chromium

Choose one of the following installation methods:

  • Using npm: @puppeteer/browsers is a standalone browser download tool; it does not require Puppeteer to be installed in your project. To install Chrome for Testing, run:

    npx @puppeteer/browsers install chrome@stable

    To install Chromium instead, run:

    npx @puppeteer/browsers install chromium@latest

    The command prints the path to the installed binary at the end of its output, for example:

    chrome@stable /home/user/.cache/puppeteer/chrome/linux-136.0.7103.92/chrome-linux64/chrome

    Set the CHROME_PATH environment variable to that path before running your tests.

    important

    @puppeteer/browsers install downloads the browser into a subdirectory of the current working directory. Run the command from a location where a large download is appropriate, and consider adding the resulting directory to your .gitignore.

  • Using GitHub Actions: Add the following step to your workflow file. To install Chrome for Testing:

    - name: Setup Chrome for Testing
      uses: browser-actions/setup-chrome@latest
      id: setup-chrome
      with:
        chrome-version: stable
        install-chromedriver: true

    To install Chromium instead, use latest for chrome-version:

    - name: Setup Chromium
      uses: browser-actions/setup-chrome@latest
      id: setup-chrome
      with:
        chrome-version: latest
        install-chromedriver: true

    In both cases, the binary path is available from the step's output:

    ${{ steps.setup-chrome.outputs.chrome-path }}

Configure Your Platform

Once CHROME_PATH is set, configure your test setup as follows.

WebdriverIO

Pass the binary path inside goog:chromeOptions in your WebdriverIO capabilities.

For the standalone package (wdioConfig()):

const browser = await remote(
  wdioConfig({
    axe: {
      apiKey: ACCESSIBILITY_API_KEY,
      projectId: PROJECT_ID
    },
    capabilities: {
      browserName: 'chrome',
      'goog:chromeOptions': {
        binary: process.env.CHROME_PATH
      }
    }
  })
)

For WDIO Testrunner (wdioTestRunner()):

export const config = wdioTestRunner({
  axe: {
    apiKey: ACCESSIBILITY_API_KEY,
    projectId: PROJECT_ID
  }
}, {
  capabilities: [{
    browserName: 'chrome',
    'goog:chromeOptions': {
      binary: process.env.CHROME_PATH
    }
  }]
})

WebDriverJS

Call webdriverConfig() first to get the Chrome options object, then set the binary path before building the browser:

const chromeOptions = webdriverConfig({
  axe: {
    apiKey: ACCESSIBILITY_API_KEY,
    projectId: PROJECT_ID
  }
})
chromeOptions.setBinaryPath(process.env.CHROME_PATH)

const browser = await new Builder()
  .forBrowser('chrome')
  .setChromeOptions(chromeOptions)
  .build()

Java Selenium

Set the binary path on ChromeOptions before calling watcher.configure():

AxeWatcherOptions options =
    new AxeWatcherOptions()
        .setApiKey(System.getenv("ACCESSIBILITY_API_KEY"))
        .setProjectId(System.getenv("PROJECT_ID"));
AxeWatcher watcher = new AxeWatcher(options);
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setBinary(System.getenv("CHROME_PATH"));
chromeOptions = watcher.configure(chromeOptions);
WebDriver wrappedDriver = watcher.wrapDriver(new ChromeDriver(chromeOptions));