Error when attempting to move selenium using headlesschrome on lambda

Asked 5 months ago, Updated 5 months ago, 11 views

It's multi-post.

I also asked for answers on teratail, but
I will also post it here as it does not seem to solve the problem.

I'd like to use headlesschrome on lambda and use selenium.
It's not working.

I used this as a reference to build the environment.
The version is the same as this one.

It works locally, but
I get an error trying to run on lambda.

It looks like the send_keys method is not working.

By the way, the local is Python 2.7.16 and
Lambda is Python 3.7.

When I looked into various things,
I've seen some articles saying that set_keys are not compatible because the chrome-driver version is older.
Currently, the headless-chrominium version is not keeping up with the latest chrome version, so
I wonder if it is impossible for them to deal with it.
(The local chrome version is up to date, so does it work with the chrome-driver version?)

I switched the local Python version to 3 series (3.7.3) combined with lambda side and ran it.
It worked well locally.

If you know anything, please take care of me.

Error Message

Test Event Name

  "errorMessage": "'dict' object has no attribute's send_keys',
  "errorType": "AttributeError",
  "stackTrace": [
    "  File\"/var/task/\", line 39, in lambda_handler\ndriver.find_element_by_name(\"user_password\").send_keys(\"XXXXXX\")\n"

Function Logs
START RequestId:XXX Version: $LATEST
[ERROR] AttributeError: 'dict' object has no attribute' send_keys'
Traceback (most recent call last):
  File"/var/task/", line 39, in lambda_handler
END RequestId: XXX
REPORT RequestId:XXX Duration: 39112.18 ms Built Duration: 39113 ms Memory Size: 256 MB Max Memory Used: 256 MB Init Duration: 301.10 ms

Request ID

Code (Python)


import time
import subprocess
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
import requests
import json
from selenium.webdriver.common.keys import Keys

deflambda_handler(event, context):


    # Browser Definitions
    driver = webdriver.Chrome(

    # Go to target site


    # Username

    # password


python selenium

2022-09-30 11:23

2 Answers

I saw some articles saying that set_keys is not compatible because the chrome-driver version is old.

The headless-chromium, chromedriver version of the Qiita article that you referred to in building your environment and
Compare to the local headless-chromium, chromedriver version.

The Qiita article covered the headerless-chromium of v1.0.0-37 and the download of chromedriver_linux64 of 2.37


$curl-SL >

$curl-SL >

However, the headless-chromium in the repository was v1.0.0-57.

Chromedriver also has a newer version.

2022-09-30 11:23

I encountered a similar event, but please refer to the URL below.

options.add_experimental_option("w3c", True)

It worked after I configured the .
I don't know if it's exactly the same thing, but just for your information.

So, it's another option that could lead to this error. You can fix it by removing it or changing it value to True.

2022-09-30 11:23

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.