I am trying to run headless-chromium using aws lambda, I have 3 layers; headless-chromium69, chromedriver2.44 and selenium3.14
This is my code
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
path = '/tmp/'
def lambda_handler():
try:
options = Options()
options.binary_location = "/opt/python/headless-chromium"
options.headless = True
browser = webdriver.Chrome(options=options, executable_path="/opt/python/chromedriver")
browser.get('http://www.google.com')
return browser.title
except Exception as e:
print(e)
Testing from aws console gives me this error
Message: unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /opt/python/headless-chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
(Driver info: chromedriver=2.44.609551 (5d576e9a44fe4c5b6a07e568f1ebc753f1214634),platform=Linux 4.14.133-97.112.amzn2.x86_64 x86_64)