I’m trying to run axe-core/cli as a Github Action on my pipeline, however I keep getting this error:
"Error: session not created: This version of ChromeDriver only supports Chrome version 121
Current browser version is 120.0.6099.224 with binary path /opt/google/chrome/chrome
Please install a matching version of ChromeDriver and run axe with the –chromedriver-path option"
I’m not sure what to do here, and struggling to find any useful information. Anyone know how I can get this to work?
name: CI Tests
on:
pull_request:
branches: [main]
jobs:
axe:
runs-on: ubuntu-latest
env:
WORDPRESS_API_URL: XYZ
GITHUB_API_SECRET: ABC
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v1
with:
node-version: 18.x
- run: yarn install
- run: yarn run build
- run: yarn dev & npx wait-on http://localhost:3000
- name: Run axe
run: |
yarn add @axe-core/cli
npx axe http://localhost:3000 --exit
2
Answers
Thanks to Steven Lambert for pointing me in the right direction. With a bit of trial and error, I ended up with this, which is working:
@axe-core/cli
uses chromedriver under the hood to open the desired page and run axe. Using chromedriver requires that it uses a version of Chrome that is the same or close to the same with it’s own version. When it’s not it throws that error.There’s a few different ways to fix the issue. You could install a chrome and chromedriver version in the action that are the same version and location as
@axe-core/cli
. Alternatively you could install chromedriver at any location and pass the location to@axe-core/cli
using the--chromedriver-path
option (as the error message suggests).