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

cli: Provide better error message for ChromeDriver version mismatch #679

Closed
not-my-profile opened this issue Mar 6, 2023 · 13 comments · Fixed by #680 · 4 remaining pull requests
Closed

cli: Provide better error message for ChromeDriver version mismatch #679

not-my-profile opened this issue Mar 6, 2023 · 13 comments · Fixed by #680 · 4 remaining pull requests

Comments

@not-my-profile
Copy link
Contributor

I am on Debian where the latest stable version of chromium is 108.

$ npm install -g @axe-core/cli
$ axe http://example.com
Running axe-core 4.6.3 in chrome-headless
Error: SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 109
Current browser version is 108.0.5359.94 with binary path /usr/bin/chromium
    at Object.throwDecodedError (/home/martin/.local/share/fnm/node-versions/v16.13.2/installation/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/error.js:522:15)
    at parseHttpResponse (/home/martin/.local/share/fnm/node-versions/v16.13.2/installation/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/http.js:589:13)
    at Executor.execute (/home/martin/.local/share/fnm/node-versions/v16.13.2/installation/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/http.js:514:28)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  remoteStacktrace: '#0 0x560eb88a3303 <unknown>\n' +
    '#1 0x560eb8677d37 <unknown>\n' +
    '#2 0x560eb86a4a54 <unknown>\n' +
    '#3 0x560eb869f80e <unknown>\n' +
    '#4 0x560eb869c330 <unknown>\n' +
    '#5 0x560eb86dd4a6 <unknown>\n' +
    '#6 0x560eb86d4753 <unknown>\n' +
    '#7 0x560eb86a7a14 <unknown>\n' +
    '#8 0x560eb86a8b7e <unknown>\n' +
    '#9 0x560eb88f232e <unknown>\n' +
    '#10 0x560eb88f5c0e <unknown>\n' +
    '#11 0x560eb88d8610 <unknown>\n' +
    '#12 0x560eb88f6c23 <unknown>\n' +
    '#13 0x560eb88ca545 <unknown>\n' +
    '#14 0x560eb89176a8 <unknown>\n' +
    '#15 0x560eb8917836 <unknown>\n' +
    '#16 0x560eb8932d13 <unknown>\n' +
    '#17 0x7fbc73e9aea7 start_thread\n'
}
Please report the problem to: https://github.com/dequelabs/axe-core-npm/issues/

To be honest i am not sure how to get this working. @axe-core/puppeteer works fine since installing puppeteer also automatically downloads chromium into ~/.cache/puppeteer/chrome/. However the following doesn't work:

axe --chromedriver-path ~/.cache/puppeteer/chrome/linux-1095492/chrome-linux/chrome http://example.com/

it just opens chrome (not in headless mode for some reason) and doesn't open example.com (neither does it say "this chrome instance is remote controlled") ... probably because that chrome version is 111.0.5555.0, which isn't 109? How am I supposed to install Chrome 109?

@not-my-profile not-my-profile changed the title Provide better error message when Chrome version is unsupported cli: Provide better error message when Chrome version is unsupported Mar 6, 2023
@straker
Copy link
Contributor

straker commented Mar 6, 2023

It looks like you used the Chrome executable as a chromedriver, which is why it launched chrome. You should be able to install chromedriver at the desired version then use that for the path. Something like:

$ npm install -g chromedriver@108
$ axe --chromedriver-path $(npm root -g)/chromedriver/bin/chromedriver http://example.com/

@sacsar
Copy link

sacsar commented Mar 14, 2023

For what it's worth, passing --chromedriver-path is not working for me. axe still finds /usr/sbin/chromium.

(axe version 4.6.0, axe-core 4.6.3)

@not-my-profile
Copy link
Contributor Author

Huh, that's weird. Passing --chromedriver-path $(npm root -g)/chromedriver/bin/chromedriver works fine for me after installing the chromedriver package.

@llimllib
Copy link

llimllib commented Mar 15, 2023

Doesn't work for me either (mac os ventura, node 19.4.0). I'm passing a path that exists and has the correct version, but axe is trying to use the system browser anwyay:

$ npm install -g @axe-core/[email protected] chromedriver@109

added 34 packages, removed 32 packages, and changed 32 packages in 4s

4 packages are looking for funding
  run `npm fund` for details
Reshimming asdf nodejs...

$ axe --chromedriver-path $(npm root -g)/chromedriver/bin/chromedriver http://google.com
Running axe-core 4.6.3 in chrome-headless
Error: SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 109
Current browser version is 111.0.5563.64 with binary path /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
<snip>

$ ls "$(npm root -g)/chromedriver/bin/chromedriver"
/Users/llimllib/.asdf/installs/nodejs/19.4.0/lib/node_modules/chromedriver/bin/chromedriver*

$ "$(npm root -g)/chromedriver/bin/chromedriver" --version
ChromeDriver 109.0.5414.74 (e7c5703604daa9cc128ccf5a5d3e993513758913-refs/branch-heads/5414@{#1172})

$ axe --version
4.6.0

oddly, these same steps worked perfectly in CI, but they don't work on my machine

llimllib added a commit to adhocteam/uswds_nextjs_starter that referenced this issue Mar 15, 2023
[this
comment](dequelabs/axe-core-npm#679 (comment))
showed me how to pin the axe and chromedriver version, to hopefully
prevent mismatches.

closes #18
@not-my-profile
Copy link
Contributor Author

not-my-profile commented Mar 16, 2023

Oh yes, you have to install the right version of chromedriver matching your installed version of Chrome, which is 111 so you'll need to install chromedriver@111.

axe still finds /usr/sbin/chromium.

Yes chromedriver doesn't replace Chrom(e|ium) ... the version just has to match.

@TheBoatyMcBoatFace
Copy link

I see the same problem

axe https://example.com
Running axe-core 4.6.3 in chrome-headless
Error: SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 109
Current browser version is 111.0.5563.64 with binary path /Applications/Google Chrome.app/Contents/MacOS/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:589:13)
    at Executor.execute (/usr/local/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/http.js:514:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  remoteStacktrace: '0   chromedriver                        0x0000000106c78fa8 chromedriver + 4886440\n' +
    '1   chromedriver                        0x0000000106bf6643 chromedriver + 4351555\n' +
    '2   chromedriver                        0x0000000106844b27 chromedriver + 477991\n' +
    '3   chromedriver                        0x0000000106876659 chromedriver + 681561\n' +
    '4   chromedriver                        0x00000001068713bb chromedriver + 660411\n' +
    '5   chromedriver                        0x000000010686d712 chromedriver + 644882\n' +
    '6   chromedriver                        0x00000001068b8bd7 chromedriver + 953303\n' +
    '7   chromedriver                        0x00000001068af3a3 chromedriver + 914339\n' +
    '8   chromedriver                        0x000000010687957f chromedriver + 693631\n' +
    '9   chromedriver                        0x000000010687ab1e chromedriver + 699166\n' +
    '10  chromedriver                        0x0000000106c45b9e chromedriver + 4676510\n' +
    '11  chromedriver                        0x0000000106c4a91e chromedriver + 4696350\n' +
    '12  chromedriver                        0x0000000106c5219f chromedriver + 4727199\n' +
    '13  chromedriver                        0x0000000106c4b81a chromedriver + 4700186\n' +
    '14  chromedriver                        0x0000000106c1ea62 chromedriver + 4516450\n' +
    '15  chromedriver                        0x0000000106c6a8c8 chromedriver + 4827336\n' +
    '16  chromedriver                        0x0000000106c6aa45 chromedriver + 4827717\n' +
    '17  chromedriver                        0x0000000106c807ef chromedriver + 4917231\n' +
    '18  libsystem_pthread.dylib             0x00007ff80e86b259 _pthread_start + 125\n' +
    '19  libsystem_pthread.dylib             0x00007ff80e866c7b thread_start + 15\n'
}
Please report the problem to: https://github.com/dequelabs/axe-core-npm/issues/

I installed chrome108 and same with 111

npm install -g chromedriver@108

Still getting the error

axe --chromedriver-path $(npm root -g)/chromedriver/bin/chromedriver http://example.com/
Running axe-core 4.6.3 in chrome-headless
Error: SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 108
Current browser version is 111.0.5563.64 with binary path /Applications/Google Chrome.app/Contents/MacOS/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:589:13)
    at Executor.execute (/usr/local/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/http.js:514:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  remoteStacktrace: '0   chromedriver                        0x0000000103959f38 chromedriver + 4910904\n' +
    '1   chromedriver                        0x00000001038d9a03 chromedriver + 4385283\n' +
    '2   chromedriver                        0x000000010351e747 chromedriver + 472903\n' +
    '3   chromedriver                        0x00000001035503e9 chromedriver + 676841\n' +
    '4   chromedriver                        0x000000010354b14b chromedriver + 655691\n' +
    '5   chromedriver                        0x00000001035474a2 chromedriver + 640162\n' +
    '6   chromedriver                        0x0000000103592460 chromedriver + 947296\n' +
    '7   chromedriver                        0x0000000103591cbf chromedriver + 945343\n' +
    '8   chromedriver                        0x0000000103588ee3 chromedriver + 909027\n' +
    '9   chromedriver                        0x000000010355330c chromedriver + 688908\n' +
    '10  chromedriver                        0x000000010355488e chromedriver + 694414\n' +
    '11  chromedriver                        0x00000001039271de chromedriver + 4702686\n' +
    '12  chromedriver                        0x000000010392bb19 chromedriver + 4721433\n' +
    '13  chromedriver                        0x000000010393328e chromedriver + 4752014\n' +
    '14  chromedriver                        0x000000010392c91a chromedriver + 4725018\n' +
    '15  chromedriver                        0x0000000103900b02 chromedriver + 4545282\n' +
    '16  chromedriver                        0x000000010394b888 chromedriver + 4851848\n' +
    '17  chromedriver                        0x000000010394ba05 chromedriver + 4852229\n' +
    '18  chromedriver                        0x0000000103961e5f chromedriver + 4943455\n' +
    '19  libsystem_pthread.dylib             0x00007ff80e86b259 _pthread_start + 125\n' +
    '20  libsystem_pthread.dylib             0x00007ff80e866c7b thread_start + 15\n'
}
Please report the problem to: https://github.com/dequelabs/axe-core-npm/issues/

I'm not sure of a fix, but the issue is still around

@Zidious
Copy link
Contributor

Zidious commented Mar 16, 2023

Hey, you will not be able to use a Chromedriver version that does not match your current Chrome version (currently 111), it will work with 1 version lower than your current Chrome version.

image

@sacsar
Copy link

sacsar commented Mar 16, 2023

🤦 Thank you -- I thought the 108 in @straker's original response was a typo.

@llimllib
Copy link

llimllib commented Mar 16, 2023

ah ha! I guess I thought that the chromedriver message was saying that axe only supported the noted version, not understanding that axe just needs any version of chromedriver that supports the version of chrome present on the system. I guess I assumed that the chromedriver package included chrome.

Installing chromedriver@111 works:

$ npm install -g @axe-core/[email protected] chromedriver@111

added 32 packages, and changed 66 packages in 7s

4 packages are looking for funding
  run `npm fund` for details
Reshimming asdf nodejs...

$ axe --chromedriver-path $(npm root -g)/chromedriver/bin/chromedriver http://google.com
Running axe-core 4.6.3 in chrome-headless

Testing http://google.com ... please wait, this may take a minute.

Thanks!

@TheBoatyMcBoatFace
Copy link

Thanks @Zidious!

@not-my-profile -
See below

Steps to Fix/Get Working

  1. Get chromedriver version
    chromedriver --version

    That will spit out something like this ChromeDriver 111.0.5563.64 (c710e93d5b63b7095afe8c2c17df34408078439d-refs/branch-heads/5563@{#995})

  2. Find out where chromedriver is
    where chromedriver

    Which gives you something like this
    /usr/local/bin/chromedriver From a mac

  3. Run axe cli with the following flag. Based on above step
    Flag: --chromedriver-path /usr/local/bin/chromedriver

Example:

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

Getting Fancy

axe www.google.com --chromedriver-path $(where chromedriver)

Getting Fancier

This asks for you to input the URL after running it. IE you don't have to put the URL between axe and --chrome

echo -n "URL to check: "
read url
axe "$url" --chromedriver-path "$(where chromedriver)"

To-Do for Me

@straker
Copy link
Contributor

straker commented Mar 20, 2023

@TheBoatyMcBoatFace Just as an FYI, a user can have multiple chromedrivers installed at a time (for example one in global npm and another from /user/local), so just saying where chromedriver may give you the wrong one depending on which version you were aiming to use and which one where reports from first.

@davereid
Copy link

davereid commented Mar 20, 2023

FYI Github Action's Ubuntu runners may fail since the where command is not available, so replace $(where chromedriver) with $(which chromedriver)

@not-my-profile not-my-profile changed the title cli: Provide better error message when Chrome version is unsupported cli: Provide better error message for ChromeDriver version mismatch Mar 21, 2023
not-my-profile added a commit to not-my-profile/axe-core-npm that referenced this issue Jun 30, 2023
not-my-profile added a commit to not-my-profile/axe-core-npm that referenced this issue Jul 2, 2023
@padmavemulapati
Copy link

padmavemulapati commented Oct 11, 2023

Verified with the latest version of @axe-core/cli_4.7.4-62fd241.0, chromedriver when ever version compatibility error showing, we can have a solution uisng--chromedriver-path` option.

Steps to validate:

  1. To get a updated chromedriver version at the global location
    npm install chromedriver --update -g

  2. To Find out where chromedriver is we can use a command at the terminal in MAC - which chromedriver and in windows - Where chromedriver

    Which gives you something like this
    /usr/local/bin/chromedriver From a mac

  3. Run axe cli with the following flag. Based on above step
    Flag: --chromedriver-path /usr/local/bin/chromedriver

Example:

axe  --chromedriver-path /usr/local/bin/chromedriver  https://google.com

another way

axe --chromedriver-path $(npm root -g)/chromedriver/bin/chromedriver http://google.com

We can see the output successfully, even we have non-compatible version saved in our machine and trying to run axe-cli . This above process will update the compatibility version of chromdriver and pick the path from where the compatible version of chromedriver located and working as expected.

Output:

axe --chromedriver-path $(npm root -g)/chromedriver/bin/chromedriver http://google.com
Running axe-core 4.8.2 in chrome-headless

Testing http://google.com ... please wait, this may take a minute.

  Violation of "aria-allowed-role" with 1 occurrences!
    Ensures role attribute has an appropriate value for the element. Correct invalid elements at:
     - #APjFqb
    For details, see: https://dequeuniversity.com/rules/axe/4.8/aria-allowed-role

  Violation of "aria-valid-attr-value" with 2 occurrences!
    Ensures all ARIA attributes have valid values. Correct invalid elements at:
     - #APjFqb
     - .ayzqOc
    For details, see: https://dequeuniversity.com/rules/axe/4.8/aria-valid-attr-value

  Violation of "color-contrast" with 8 occurrences!
    Ensures the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds. Correct invalid elements at:
     - .uU7dJb
     - a[data-usg="AOvVaw33zjaJZ_ogw8iPEm4kPGYh"]
     - a[data-usg="AOvVaw3Oj62V1xNd5oAI6Vxou5Lx"]
     - a[data-usg="AOvVaw2SJ4zwRVXKyZr53qG9dm4K"]
     - .pHiOh:nth-child(4)
     - a[data-usg="AOvVaw2y-DJehqHRQuhUzwsARmol"]
     - a[data-usg="AOvVaw25sheD5OGrPUyBw_FdCQOy"]
     - .ayzqOc
    For details, see: https://dequeuniversity.com/rules/axe/4.8/color-contrast

  Violation of "region" with 8 occurrences!
    Ensures all page content is contained by landmarks. Correct invalid elements at:
     - .gb_yd > div:nth-child(1)
     - .gb_za
     - .lnXdpd
     - #SIvCob
     - .uU7dJb
     - .AghGtd
     - a[data-usg="AOvVaw2y-DJehqHRQuhUzwsARmol"]
     - a[data-usg="AOvVaw25sheD5OGrPUyBw_FdCQOy"]
    For details, see: https://dequeuniversity.com/rules/axe/4.8/region

19 Accessibility issues detected.
Testing complete of 1 pages

Please note that only 20% to 50% of all accessibility issues can automatically be detected. 
Manual testing is always required. For more information see:
https://dequeuniversity.com/curriculum/courses/testingmethods

Screenshot:

image

Environment:

Label Value
Product axe-core-npm/react
Version 4.7.4-62fd241.0
OS-Details _MAC- Intel Core i7 - 11.6.8 & Windows11 _
BrowserDetails Chrome Version 117.0.5938.88 (Official Build) (64-bit) & Firefox 117.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment