Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Axe core cli not working : Fails with "An error occurred while testing this page." #401

Closed
mkathu opened this issue Nov 3, 2021 · 17 comments
Assignees
Labels
PR A PR has been opened for this issue question Further information is requested

Comments

@mkathu
Copy link

mkathu commented Nov 3, 2021

As part of CI/CD I am trying to use axe-core/cli to scan couple of pages via github actions workflow. The steps were working earlier but not it fails with error. Below is the workflow and screenshot of the logs.

jobs:
  axe-core-scan-whitelabel:
    runs-on: ubuntu-latest
    steps:
      - name: setup npm
        uses: actions/checkout@v2
      - name: Read file with urls
        id: pickUrls
        run: echo ::set-output name=urls::$(cat .github/workflows/${{ secrets.ENVIRONMENT }}/${{env.FILE_TO_READ}}.txt) 
      - name: run axe scan on urls
        run: |
          npm install @axe-core/cli -g
          axe ${{steps.pickUrls.outputs.urls}} --browser firefox --verbose --load-delay=${{env.PAGE_LOAD_WAIT_TIME}} --tags ${{env.STANDARD_TO_CHECK}}

image

Product: axe-core/cli

Expectation: The github workflow should be able to execute and scan all the URL's specified.

Actual: The execution fails.

Motivation: Disables the usage in CI/CD

axe-core/cli version: 4.3.1
axe-core version 4.3.5

  • Node version: v14.18.1
  • Platform: Ubuntu latest
  • Browser : Chrome and Firefox
@michael-siek
Copy link
Member

Thanks for reporting. I'll pass this along. Do you mind providing the dockerfile or environment?

@Zidious Zidious added the question Further information is requested label Jan 5, 2022
@rootwork
Copy link

I'm experiencing this as well, trying to use axe locally on Linux:

npm install -g @axe-core/cli

added 89 packages, and audited 90 packages in 1s

10 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
axe http://localhost:9050 --verbose
Running axe-core 4.3.5 in chrome-headless
An error occurred while testing this page.
Please report the problem to: https://github.com/dequelabs/axe-core-npm/issues/
axe https://codepen.io/rootwork/full/zYPwQbv --verbose
Running axe-core 4.3.5 in chrome-headless
An error occurred while testing this page.
Please report the problem to: https://github.com/dequelabs/axe-core-npm/issues/

(I get the same errors without the --verbose flag, was just hoping that would give more details.)

axe: 4.3.2
node: 16.13.2
npm: 8.1.2
running in zsh 5.8
on Linux Mint 20.3 (Ubuntu Focal)

Let me know if there's more information I can provide to diagnose what's tripping axe up.

@Zidious
Copy link
Contributor

Zidious commented Feb 11, 2022

Hey @rootwork,

Could you please do the same test but add the flag --show-errors so we can a get a full stack-trace. I have a suspicion its ChromeDriver related, but want to make sure.

Example:

axe http://localhost:9050/ --verbose --show-errors
axe https://codepen.io/rootwork/full/zYPwQbv --verbose --show-errors

@rootwork
Copy link

@Zidious Yep that looks like the issue:

Error: "session not created: This version of ChromeDriver only supports Chrome version 96\nCurrent browser version is 98.0.4758.80 with binary path /usr/bin/chromium" 
 $s SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 96
Current browser version is 98.0.4758.80 with binary path /usr/bin/chromium
    at Object.throwDecodedError (/home/ivan/n/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/error.js:522:15)
    at parseHttpResponse (/home/ivan/n/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/http.js:548:13)
    at Executor.execute (/home/ivan/n/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/http.js:474:28)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

@Zidious
Copy link
Contributor

Zidious commented Feb 11, 2022

If you could update your ChromeDriver version to 98. You may need to allow the ChromeDriver application in the firewall any try again.

Edit: if the the above does not succeed, please try to pass the path of the ChromeDriver to the CLI tool:

axe www.google.com --chromedriver-path /usr/local/bin/chromedriver

I have opened a ticket to update the ChromeDriver dependencies to V98 which will follow up with a PR shortly.

@padmavemulapati
Copy link

Seeing the same issue when chromedriver updated to 98.

@rootwork
Copy link

First just to be clear, I never installed ChromeDriver myself. I'm not sure if it comes with Chromium, axe, or my Linux distro, but I've definitely never downloaded it directly. I do see now that axe-core/cli's getting started says to install a webdriver, so I'm sorry for overlooking that.

In any case, which chromedriver told me where it was, so I downloaded v98, moved it in, and reloaded my shell.

chromedriver --version:

ChromeDriver 98.0.4758.80 (7f0488e8ba0d8e019187c6325a16c29d9b7f4989-refs/branch-heads/4758@{#972})

Nonetheless, when I run axe I still get the same error:

session not created: This version of ChromeDriver only supports Chrome version 96\nCurrent browser version is 98.0.4758.80 with binary path /usr/bin/chromium

@rootwork
Copy link

Oh and I meant to add, I get the same error when specifying the ChromeDriver path:

$ which chromedriver
/usr/bin/chromedriver

$ axe www.google.com --chromedriver-path /usr/bin/chromedriver --show-errors
Running axe-core 4.4.1 in chrome-headless
Error: "session not created: This version of ChromeDriver only supports Chrome version 96...

@Zidious
Copy link
Contributor

Zidious commented Feb 15, 2022

Hey @rootwork,

Apologies for the delay, we recently merged a PR to fix the ChromeDriver issue (to use latest for reference see #454). We will be doing a patch release shortly. However we have a canary release available, could you please try installing: npm i @axe-core/cli@4.4.1-alpha.247 -g. This build includes the fix:

image

@Zidious Zidious added the PR A PR has been opened for this issue label Feb 15, 2022
@mkathu
Copy link
Author

mkathu commented Mar 11, 2022

Hey @rootwork,

Apologies for the delay, we recently merged a PR to fix the ChromeDriver issue (to use latest for reference see #454). We will be doing a patch release shortly. However we have a canary release available, could you please try installing: npm i @axe-core/cli@4.4.1-alpha.247 -g. This build includes the fix:

image

hi,

I am trying to run axe tests with axe core via github actions. I tried to use npm i @axe-core/cli@4.4.1-alpha.247 -g below is the error i got. I have tried other versions as well. Either i get error stating axe command not found or the chrome driver does not work for the browser. This was working earlier with npm i @axe-core/cli@4.3.2-alpha.209 -g.

Running axe-core 4.4.1 in chrome-headless
Error: SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 99
Current browser version is 98.0.4758.102 with binary path /usr/bin/google-chrome
    at Object.throwDecodedError (/usr/local/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/error.js:522:15)
    at parseHttpResponse (/usr/local/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/http.js:548:13)
    at Executor.execute (/usr/local/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/http.js:474:28)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  remoteStacktrace: '#0 0x565101bf97d3 <unknown>\n' +
    '#1 0x565101955688 <unknown>\n' +
    '#2 0x56510197c6a0 <unknown>\n' +
    '#3 0x565101977e36 <unknown>\n' +
    '#4 0x56510197468f <unknown>\n' +
    '#5 0x5651019af355 <unknown>\n' +
    '#6 0x5651019a95a3 <unknown>\n' +
    '#7 0x56510197eddc <unknown>\n' +
    '#8 0x56510197fde5 <unknown>\n' +
    '#9 0x565101c2a49d <unknown>\n' +
    '#10 0x565101c4360c <unknown>\n' +
    '#11 0x565101c2c205 <unknown>\n' +
    '#12 0x565101c43ee5 <unknown>\n' +
    '#13 0x565101c20070 <unknown>\n' +
    '#14 0x565101c5f488 <unknown>\n' +
    '#15 0x565101c5f60c <unknown>\n' +
    '#16 0x565101c78c6d <unknown>\n' +
    '#17 0x7ff0e336c609 <unknown>\n'
}
Please report the problem to: https://github.com/dequelabs/axe-core-npm/issues/

@Zidious
Copy link
Contributor

Zidious commented Mar 12, 2022

@mkathu Hey, as we are using the latest version of ChromeDriver, you will need to keep your Chrome Browser versions up to date. The error message you are receiving:

Error: SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 99
Current browser version is 98.0.4758.102 with binary path /usr/bin/google-chrome

Means your Chrome browser is out of date. If you upgrade it v99 you should not have any issues

image

@metalandcoffee
Copy link

Hi! I just wanted to chime in because I am also having issues with getting this tool to work in Github Actions. I am not trying to run this locally - I am running this in the virtual Github Actions environment. Does anyone have any tips on how to get this running?

Here is the step in my yml file

      - name: Run Accessibility Tool
        run: |
          npm install -g @axe-core/cli
          axe http://localhost:3000 --browser chrome --verbose --show-errors

Here's the results.

Running axe-core 4.4.1 in chrome
Error: WebDriverError: unknown error: Chrome failed to start: crashed.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
    at Object.throwDecodedError (/opt/hostedtoolcache/node/16.14.0/x64/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/error.js:522:15)
    at parseHttpResponse (/opt/hostedtoolcache/node/16.14.0/x64/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/http.js:548:13)
    at Executor.execute (/opt/hostedtoolcache/node/16.14.0/x64/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/http.js:474:28)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  remoteStacktrace: '#0 0x55d6f74b77d3 <unknown>\n' +
    '#1 0x55d6f7213688 <unknown>\n' +
    '#2 0x55d6f7236b27 <unknown>\n' +
    '#3 0x55d6f723268f <unknown>\n' +
    '#4 0x55d6f726d355 <unknown>\n' +
    '#5 0x55d6f72675a3 <unknown>\n' +
    '#6 0x55d6f723cddc <unknown>\n' +
    '#7 0x55d6f723dde5 <unknown>\n' +
    '#8 0x55d6f74e849d <unknown>\n' +
    '#9 0x55d6f750160c <unknown>\n' +
    '#10 0x55d6f74ea[20](https://github.com/metalandcoffee/metalandcoffee.github.io/runs/5695806431?check_suite_focus=true#step:5:20)5 <unknown>\n' +
    '#11 0x55d6f7501ee5 <unknown>\n' +
    '#12 0x55d6f74de070 <unknown>\n' +
    '#13 0x55d6f751d488 <unknown>\n' +
    '#14 0x55d6f751d60c <unknown>\n' +
    '#15 0x55d6f7536c6d <unknown>\n' +
    '#16 0x7f[30](https://github.com/metalandcoffee/metalandcoffee.github.io/runs/5695806431?check_suite_focus=true#step:5:30)1cbcc609 <unknown>\n'
}

@shaquillaevelyn
Copy link

shaquillaevelyn commented Mar 31, 2022

Hello all!

it seems as though I have run into the same issue. Updated my chrome. it is chromedriver@100 being installed and it is still running this error.

doesnt make a difference if i use the canary release command (npm i @axe-core/cli@4.4.1-alpha.247 -g) either.

i even tried adding this action above it
https://github.com/marketplace/actions/setup-chrome

if anybody can shed some light- would be grateful !


  npm install @axe-core/cli --global
  axe --stdout http://localhost:3000 --tags wcag2a --verbose --show-errors --exit
  shell: /usr/bin/bash -e {0}
/opt/hostedtoolcache/node/13.14.0/x64/bin/axe -> /opt/hostedtoolcache/node/13.14.0/x64/lib/node_modules/@axe-core/cli/dist/src/bin/cli.js

> chromedriver@100.0.0 install /opt/hostedtoolcache/node/13.14.0/x64/lib/node_modules/@axe-core/cli/node_modules/chromedriver
> node install.js

Current existing ChromeDriver binary is unavailable, proceeding with download and extraction.
Downloading from file:  https://chromedriver.storage.googleapis.com/100.0.4896.60/chromedriver_linux64.zip
Saving to file: /tmp/100.0.4896.60/chromedriver/chromedriver_linux64.zip
Received 1040K...
Received 2080K...
Received 3120K...
Received 4160K...
Received 5200K...
Received 6240K...
Received 6822K total.
Extracting zip contents to /tmp/100.0.4896.60/chromedriver.
Copying from /tmp/100.0.4896.60/chromedriver to target path /opt/hostedtoolcache/node/13.14.0/x64/lib/node_modules/@axe-core/cli/node_modules/chromedriver/lib/chromedriver
Fixing file permissions.
Done. ChromeDriver binary available at /opt/hostedtoolcache/node/13.14.0/x64/lib/node_modules/@axe-core/cli/node_modules/chromedriver/lib/chromedriver/chromedriver
+ @axe-core/cli@4.4.2
added 89 packages from 121 contributors in 6.887s
Error: SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 100
Current browser version is 98.0.4758.102 with binary path /usr/bin/google-chrome
    at Object.throwDecodedError (/opt/hostedtoolcache/node/13.14.0/x64/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/error.js:522:15)
    at parseHttpResponse (/opt/hostedtoolcache/node/13.14.0/x64/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/http.js:548:13)
    at Executor.execute (/opt/hostedtoolcache/node/13.14.0/x64/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/http.js:474:28)
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  remoteStacktrace: '#0 0x55d1110e4ad3 <unknown>\n' +
    '#1 0x55d110e44568 <unknown>\n' +
    '#2 0x55d110e6b6b5 <unknown>\n' +
    '#3 0x55d110e66e54 <unknown>\n' +
    '#4 0x55d110e6323a <unknown>\n' +
    '#5 0x55d110e9e2ba <unknown>\n' +
    '#6 0x55d110e984e3 <unknown>\n' +
    '#7 0x55d110e6dd1a <unknown>\n' +
    '#8 0x55d110e6ee75 <unknown>\n' +
    '#9 0x55d111112efd <unknown>\n' +
    '#10 0x55d11112c19b <unknown>\n' +
    '#11 0x55d111114c65 <unknown>\n' +
    '#12 0x55d11112cec8 <unknown>\n' +
    '#13 0x55d111108360 <unknown>\n' +
    '#14 0x55d111148a68 <unknown>\n' +
    '#15 0x55d111148be8 <unknown>\n' +
    '#16 0x55d1111627fd <unknown>\n' +
    '#17 0x7efd7914e609 <unknown>\n'
}
Please report the problem to: https://github.com/dequelabs/axe-core-npm/issues/

Error: Process completed with exit code 1.

@Zidious
Copy link
Contributor

Zidious commented Apr 5, 2022

Hey @shaquillaevelyn,

The CLI is using the latest version of ChromeDriver at the moment it would be 100 upon installation. Your current chrome version is Current browser version is 98.0.4758.102. Both Chrome and ChromeDriver versions have to match (we have no control over this aspect unfortunately).

Alternatively, you can specify a specific version of ChromeDriver using --chromedriver-path="somepath" to match your current Chrome version.

@Zidious
Copy link
Contributor

Zidious commented May 3, 2022

Closing to due inactivity. Please re-open if issue is still apparent.

@Zidious Zidious closed this as completed May 3, 2022
@george-gca
Copy link

Just ran into this issue while running in GitHub actions as @metalandcoffee, and I was able to fix it for my CI case.

I had to force installing the correct version of both Chromium and chrome-web-driver, and setting the path for it when calling axe. Here is my solution steps, or you can check my complete yml file:

      - name: Get Chromium version 🌐
        run: |
          CHROMIUM_VERSION=$(wget -qO- https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_STABLE | cut -d. -f1)
          echo "Chromium version: $CHROMIUM_VERSION"
          echo "CHROMIUM_VERSION=$CHROMIUM_VERSION" >> $GITHUB_ENV
      - name: Setup Chrome 🌐
        id: setup-chrome
        uses: browser-actions/setup-chrome@v1
        with:
          chrome-version: ${{ env.CHROMIUM_VERSION }}
      - name: Install chromedriver 🚗
        run: |
          npm install -g chromedriver@$CHROMIUM_VERSION
      - name: Run axe 🪓
        # https://github.com/dequelabs/axe-core-npm/tree/develop/packages/cli
        run: |
          npm install -g @axe-core/cli
          npm install -g http-server
          http-server _site/ &
          axe --chromedriver-path $(npm root -g)/chromedriver/bin/chromedriver http://localhost:8080/ --load-delay=1500 --exit

@kavitha186
Copy link

@george-gca I'm getting error as " Error: Error: Server terminated early with status 127
| at /opt/hostedtoolcache/node/18.19.1/x64/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/remote/index.js:259:24
| at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
"

I forceinstalled the latest versions of Chromium and Chrome driver. Chromium version is 121 ..Node version: 18

MatMoore added a commit to ministryofjustice/find-moj-data that referenced this issue Feb 26, 2024
MatMoore added a commit to ministryofjustice/find-moj-data that referenced this issue Feb 26, 2024
The chromedriver library updates more frequently than the chrome
distributed in ubuntu-latest, but these need to be the same version,
otherwise axe-core breaks.

As a workaround, try to install a version that matches whatever chrome
is on the path.

See also dequelabs/axe-core-npm#401 (comment)
mitchdawson1982 pushed a commit to ministryofjustice/find-moj-data that referenced this issue Feb 26, 2024
The chromedriver library updates more frequently than the chrome
distributed in ubuntu-latest, but these need to be the same version,
otherwise axe-core breaks.

As a workaround, try to install a version that matches whatever chrome
is on the path.

See also dequelabs/axe-core-npm#401 (comment)
mitchdawson1982 added a commit to ministryofjustice/find-moj-data that referenced this issue Feb 26, 2024
* update form with updated fields

* update form with updated fields

* implement custom property search

* update pre-commit
- add sync_with_poetry hook to keep pre-commit in sync with pyproject.toml
- config flake8
- config isort to use black via pyproject.toml
Add .secrets.baseline for detect-secrets
move testing libraries to dev.dependencies in pyproject.toml

* linting

* linting and formatting for readability

* revert domains (plural) -> domain (singular) changes (may be implemented in later PR)

* add descriptions and code annotations for added helper functions
add default for dict.get() [linting]

* keep original indent for domain filters

* linting

* add pre-commit instructions/details to readme

* Changed value for selection option an empty string and updated where_to_access choice value to 'Analytical_Platform' to avoid spaces.
q
exit
quit()
q
��[200~classifications~classifications

* Make domain a single choice field

* Removed admin.py as not required

* Moved filter code to new partial template

* refactor domain and subdomain choices to get the urn value

* build filter strings method to create filter search strings

* refactor classifications and where to access string generation, remove full query builder

* refactor where to access href creation

* add get_keys and format_label template filter functions

* Update broken tests

* add selected filters partial

* update packages

* refactor encode_without_filter function

* remove redundant code

* update tests with singular domain, classifications and where_to_access

* Update dingular domain and add linting fixes

* linter updates

* add service for dataproductdetails

* update templates - data product details and search

* url for search link and details redirect in views

* add tests for data product details and view

* add selenium test for data product detail page

* update poetry

* fix selenium tests that sometimes hit a dead end

* actually make the tests work for data product details

* this template will always be data product and align case

* rename view, service and add blank dataset template

* markdown and trim for table descriptions in data product detail page

* remove self.data_product_name from dataproductservice

* try reinstalling deps for selenium tests

* revert workflow change

* Add javascript for domain filter widget

Domain will have top level and subdomain selections, and work similarly
to "Topic/Sub-Topic" on GOV.UK search.

The form will submit domain and subdomain as separate fields, so we
need to combine them on the backend.

If javascript is not enabled, then the subdomain field is not displayed
and it will work as before.

This is tested using jest and jest-dom.

* Revert template - will add backend later

* Add test

* Install a compatable version of chrome/chromedriver

The chromedriver library updates more frequently than the chrome
distributed in ubuntu-latest, but these need to be the same version,
otherwise axe-core breaks.

As a workaround, try to install a version that matches whatever chrome
is on the path.

See also dequelabs/axe-core-npm#401 (comment)

* update form with updated fields

* update form with updated fields

* implement custom property search

* revert domains (plural) -> domain (singular) changes (may be implemented in later PR)

* Make domain a single choice field

* refactor classifications and where to access string generation, remove full query builder

* refactor where to access href creation

* update packages

* linter updates

* remove duplicated function

* update search result ui fields

* fix result type in conftest

* remove official-sensitive classification

* add Custom Properties match display and rename 'list' to value_list

---------

Co-authored-by: Tom Webber <thomas.webber@digital.justice.gov.uk>
Co-authored-by: LavMatt <mattlaverty@gmail.com>
Co-authored-by: Mat Moore <MatMoore@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR A PR has been opened for this issue question Further information is requested
Projects
None yet
Development

No branches or pull requests

9 participants