Selenium-UI-testing-with-AWS-Lambda-Layers icon indicating copy to clipboard operation
Selenium-UI-testing-with-AWS-Lambda-Layers copied to clipboard

ChromeDriver executable needs to be available in the path

Open laufergall opened this issue 4 years ago • 3 comments

I followed all steps in the README. When I execute the lambda function,

serverless invoke --function hello

I get the error:

{
    "errorMessage": "Message: 'ChromeDriver executable needs to be available in the path.                 Please download from http://code.google.com/p/chromedriver/downloads/list                and read up at http://code.google.com/p/selenium/wiki/ChromeDriver' ",
    "errorType": "WebDriverException",
    "stackTrace": [
        [
            "/var/task/handler.py",
            13,
            "hello",
            "driver = webdriver.Chrome('/opt/chromedriver', chrome_options=options)"
        ],
        [
            "/opt/python/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py",
            59,
            "__init__",
            "self.service.start()"
        ],
        [
            "/opt/python/lib/python3.6/site-packages/selenium/webdriver/chrome/service.py",
            68,
            "start",
            "and read up at http://code.google.com/p/selenium/wiki/ChromeDriver\")"
        ]
    ]
}

I have checked in the deployment bucket in S3 and the chromedriver file is under s3://selenium-layer-dev-serverlessdeploymentbucket-10lxthu8funhm/serverless/selenium-layer/dev/1586419384780-2020-04-09T08:03:04.780Z/chromedriver.zip, as it should be.

What are I missing?

laufergall avatar Apr 09 '20 08:04 laufergall

Try changing the name of the executable from "chromedriver" to something else. The error is cause from it being the same name as the folder

old: seleniumLayer/chromedriver/chromedriver

new: seleniumLayer/chromedriver/chromedriver_exec

don't forget to change your python code to reflect this new name when creating the driver

kiagam avatar Oct 08 '20 20:10 kiagam

I tried to update the code driver = webdriver.Chrome('/opt/chromedriver/chromedriver_exec',chrome_options=options) as well as driver = webdriver.Chrome('/opt/chromedriver_exec',chrome_options=options)

Still getting this error... please shed some light on what I'm doing wrong please... many thanks.

Message: 'ChromeDriver executable needs to be available in the path. Please download from http://code.google.com/p/chromedriver/downloads/list and read up at http://code.google.com/p/selenium/wiki/ChromeDriver' : WebDriverException Traceback (most recent call last):

joymike avatar Nov 06 '20 11:11 joymike

@joymike I had the same issue and renaming it worked for me. Make sure you redeploy the layer

espenhogbakk avatar Dec 04 '20 10:12 espenhogbakk