Closed jaimeiniesta closed 6 years ago
It looks like I can run chromedriver when installed in OSX:
➔ /Users/jaime/code/serverless/axe-chrome/node_modules/chromedriver/lib/chromedriver/chromedriver
Starting ChromeDriver 2.40.565386 (45a059dc425e08165f9a10324bd1380cc13ca363) on port 9515
Only local connections are allowed.
But I can't run it when installed in the Docker container:
root@9187e7fcaf36:/app# /app/node_modules/chromedriver/lib/chromedriver/chromedriver
/app/node_modules/chromedriver/lib/chromedriver/chromedriver: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
When tried in AWS Lambda, the error is different
/var/task/node_modules/selenium-webdriver/lib/promise.js:2626
throw error;
^
WebDriverError: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.9.93-41.60.amzn1.x86_64 x86_64)
at Object.checkLegacyResponse (/var/task/node_modules/selenium-webdriver/lib/error.js:546:15)
at parseHttpResponse (/var/task/node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (/var/task/node_modules/selenium-webdriver/lib/http.js:441:30)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
From: Task: WebDriver.createSession()
at Function.createSession (/var/task/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
at Function.createSession (/var/task/node_modules/selenium-webdriver/chrome.js:761:15)
at createDriver (/var/task/node_modules/selenium-webdriver/index.js:170:33)
at Builder.build (/var/task/node_modules/selenium-webdriver/index.js:642:16)
at startDriver (/var/task/node_modules/axe-cli/lib/webdriver.js:33:27)
at testPages (/var/task/node_modules/axe-cli/lib/axe-test-urls.js:11:10)
at Object.<anonymous> (/var/task/node_modules/axe-cli/index.js:73:1)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at ChildProcess.exithandler (child_process.js:275:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
killed: false,
code: 1,
signal: null
How can I specify the location of the chromedriver binary? I've tried adding /var/task/node_modules/chromedriver/lib/chromedriver
to the process.env['PATH']
(where /var/task
is the root of my script) but it makes no difference.
The error message comes from Chromedriver not being able to locate Chrome. As far as I can tell Chrome isn't installed in a place Chromedriver expects it - what exactly that is for the machine you're running it on I couldn't tell, but I think that if you add Chrome to PATH as well it should work.
I'm closing this as it isn't an Axe-cli issue though.
Thanks, it looks like it's selenium-webdriver
who can't find the Chrome executable. We're discussing it here if you're interested https://github.com/adieuadieu/serverless-chrome/issues/143
I have a project with these dependencied:
If I run
npm install
from my dev machine (OSX High Sierra), I can successfully run./node_modules/axe-cli/axe-cli http://example.com
, it runs fine with chrome-headless.But then if I delete the
node_modules
folder and I enter into a Docker container, I runnpm install
, it goes fine and gets the linux binary for chromedriver, but when I runaxe-cli
it fails with:Does it ring any bell?