0

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)
imlearningcode
  • 381
  • 1
  • 7
  • 24
  • Check this answer : https://stackoverflow.com/questions/50642308/webdriverexception-unknown-error-devtoolsactiveport-file-doesnt-exist-while-t – KunduK Sep 12 '19 at 15:18
  • Possible duplicate of [WebDriverException: unknown error: DevToolsActivePort file doesn't exist while trying to initiate Chrome Browser](https://stackoverflow.com/questions/50642308/webdriverexception-unknown-error-devtoolsactiveport-file-doesnt-exist-while-t) – Fletchy Sep 12 '19 at 15:35

0 Answers0