dequelabs / axe-cli

[Deprecated] A command-line interface for the aXe accessibility testing engine
Mozilla Public License 2.0
430 stars 35 forks source link

axe-cli chromedriver module dependency overrides local installation of chromedriver #103

Closed dannyprok closed 5 years ago

dannyprok commented 5 years ago

My local Chrome version recently upgraded to version 76, which broke execution of axe-cli with the below error as the chromedriver module version referenced in the dependencies of the project 2.46.0.

SessionNotCreatedError: session not created: Chrome version must be between 71 and 75
  (Driver info: chromedriver=2.46.628411 (3324f4c8be9ff2f70a05a30ebc72ffb013e1a71e),platform=Mac OS X 10.14.6 x86_64)

I'm on MacOS and I have version 76 of chromedriver installed and referenced on my PATH, however it seems the dependency referenced within the axe-cli project takes precedence over this installation (which makes sense).

I manually upgraded the chromedriver module within my local installation of axe-cli to 76.0.0 and now axe-cli runs successfully, but I'd prefer tie the axe-cli project to the version to chromedriver I have installed locally.

What is the best way to manage axe-cli compatibility with chromedriver/chrome updates? I'd prefer not have to update the axe-cli module manually every time the chromedriver binary falls out of date with Chrome.

Thanks!

arielsalminen commented 5 years ago

Having the exact same issue, but on our CI server causing the build to fail.

@dannyprok How did you manually update the version?

simi823 commented 5 years ago

I am having the same issue and I cannot downgrade to 75 or earlier on Windows. I removed chrome and npm installed chromedriver 75, but I get this error: "WebDriverError: unknown error: cannot find Chrome binary". And I can only install the most recent Chrome of 76.... Any ideas on how to fix this? Thank you....

simi823 commented 5 years ago

Windows Server:

PS C:\Users\Administrator\tada> chromedriver --version
ChromeDriver 75.0.3770.90 (a6dcaf7e3ec6f70a194cc25e8149475c6590e025-refs/branch-heads/3770@{#1003})

Google Chrome installed version:

Version 76.0.3809.100 (Official Build) (64-bit)

When I try axe-cli with this command:

PS C:\Users\Administrator\tada> axe https://www.silive.com
Running axe-core 3.3.1 in chrome-headless

DevTools listening on ws://127.0.0.1:59620/devtools/browser/d62ce83c-fedc-4011-87f4-f59e6efa5cc2
C:\Users\Administrator\AppData\Roaming\npm\node_modules\axe-cli\node_modules\selenium-webdriver\lib\promise.js:2626
        throw error;
        ^

SessionNotCreatedError: session not created: Chrome version must be between 71 and 75
  (Driver info: chromedriver=2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1),platform=Windows NT 10.0.17763 x86_64)
    at Object.checkLegacyResponse (C:\Users\Administrator\AppData\Roaming\npm\node_modules\axe-cli\node_modules\selenium-webdriver\lib\error.js:546:15)
    at parseHttpResponse (C:\Users\Administrator\AppData\Roaming\npm\node_modules\axe-cli\node_modules\selenium-webdriver\lib\http.js:509:13)
    at doSend.then.response (C:\Users\Administrator\AppData\Roaming\npm\node_modules\axe-cli\node_modules\selenium-webdriver\lib\http.js:441:30)
    at process._tickCallback (internal/process/next_tick.js:68:7)
From: Task: WebDriver.createSession()
    at Function.createSession (C:\Users\Administrator\AppData\Roaming\npm\node_modules\axe-cli\node_modules\selenium-webdriver\lib\webdriver.js:769:24)
    at Function.createSession (C:\Users\Administrator\AppData\Roaming\npm\node_modules\axe-cli\node_modules\selenium-webdriver\chrome.js:761:15)
    at createDriver (C:\Users\Administrator\AppData\Roaming\npm\node_modules\axe-cli\node_modules\selenium-webdriver\index.js:170:33)
    at Builder.build (C:\Users\Administrator\AppData\Roaming\npm\node_modules\axe-cli\node_modules\selenium-webdriver\index.js:642:16)
    at startDriver (C:\Users\Administrator\AppData\Roaming\npm\node_modules\axe-cli\lib\webdriver.js:35:26)
    at testPages (C:\Users\Administrator\AppData\Roaming\npm\node_modules\axe-cli\lib\axe-test-urls.js:11:10)
    at Object.<anonymous> (C:\Users\Administrator\AppData\Roaming\npm\node_modules\axe-cli\index.js:132:1)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
PS C:\Users\Administrator\tada>

I can't downgrade Chrome, so is there any other solution?

straker commented 5 years ago

Thanks for all the helpful info. We've been hit with this chromedriver problem as well and are working to fix it. I'll try to keep everyone updated as we get closer to a solution.

dannyprok commented 5 years ago

@simi823 @viljamis Apologies for not responding sooner. The way I set about resolving the above issue was to run the following command from within the axe-cli npm installation directory. For me:

From my home directory I cd to: .nvm/versions/node/v10.12.0/lib/node_modules/axe-cli/

and then ran: npm install chromedriver@76.0.0 --save-dev

Hope this helps.

straker commented 5 years ago

I've updated the chromedriver version and will create a release afterwards. We'll try to enable a dependency management plugin on this repo so it will help us keep the chromedriver versions up-to-date. What that means though is that we should work with the latest chromedriver but if you need to work with prior versions you'll need a prior version of the library that uses the desired chromedriver version.

straker commented 5 years ago

Release 3.1.1 includes the chromedriver version update.

samueleishion commented 5 years ago

@straker I've tested with version 3.1.1 and i'm still getting the same issue. Any thoughts?

Screen Shot 2019-09-10 at 6 17 36 PM

straker commented 5 years ago

Gulp-axe is pinned to version 3.0.0 of axe-cli. Might be the problem.

samueleishion commented 5 years ago

@straker I'm in the process of updating the dependencies for gulp-axe-cli (same as your link) on the branch feat/13-update-dependencies. That branch is running axe-cli@3.1.1 with chromedriver@76.0.1 as shown on the screenshot above.

straker commented 5 years ago

Ha. Sorry, didn't even notice you were the maintainer :)

So I tried your branch on a new install and I'm not seeing the same problem.

image

image

My chrome version is Version 76.0.3809.132

samueleishion commented 5 years ago

@straker sweet! let me try again...

samueleishion commented 5 years ago

@straker so I created a project, just like the one you shared here, and I still got the error. Notice on this screenshot, i'm including the error (SessionNotCreatedError), the package.json contents, and the gulpfile.js contents. Pretty much identical, but still with the same error.

Screen Shot 2019-09-12 at 11 18 41 PM

samueleishion commented 5 years ago

@straker funny enough, after I added the dependencies from your test project setup and ran npm i I got the following message:

Screen Shot 2019-09-12 at 11 23 37 PM

It found ChromeDriver version 76.0.3809.126 in /var/folders/wm/... and it copied it to the local ./node_modules directory, but still failed as pointed out on the comment right above.

I did try what @dannyprok recommended. I updated chromedriver within the local installation (in relation to my machine and nvm version) of axe-cli in ~/.nvm/versions/node/... directory and that's the only way it worked. I seem to be getting this error across multiple Mac environments, so it's definitely not a scalable solution.

Seems like this might be an issue with how chromedriver is installing or getting picked up by node (skipping local installation, in relation to the project, and getting nvm's version install)? Would it make a difference if the import of chromedriver within axe-cli explicitly references the local installation? IE/

const chromedriver = require('../../node_modules/chromedriver');

here: https://github.com/dequelabs/axe-cli/blob/develop/lib/webdriver.js#L1 . Not the most elegant solution, but thoughts?

Also, for reference, Chrome version is the same as the one you pointed out: 76.0.3809.132. Lastly, I tested running npm@6.9.0 and node@12.6.0.

straker commented 5 years ago

How very strange. I'll do some digging and see what can be done.

straker commented 5 years ago

Would anyone be opposed to the idea of adding a chromedriver-path option to the library? The flag would let you specify the path to your version of chromedriver and axe-cli would use that instead of the one it installed? This would let you use any chromedriver version without needing to change the internal installed version.

axe www.deque.com --chromedriver-path 'path/to/driver'
simi823 commented 5 years ago

As long as I don't have to change the current way it calls chromedriver if I don't use this option, I think it's a great addition to the tool. Thanks.

straker commented 5 years ago

Yes, the default would be to use the installed version provided by axe-cli, which when #119 is merged would always be the latest version of chromedriver.

samueleishion commented 5 years ago

@straker nice! I wouldn't be against it. Similar to @simi823 I'd like to use the installed version from axe-cli by default, as you've also pointed out. Just to clarify, this would make the one in the project's ./node_modules/chromedriver the default version, correct?

straker commented 5 years ago

Yep, so long as npm resolves it that way.

stephenmathieson commented 5 years ago

Can we close this now that #123 landed?