You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am running python script using selenium in aws lambda. I have created 2 layers 1 for selenium and 1 for chromedriver and headless-chromium. On execution I receive error
Response { "errorMessage": "Message: Service /opt/chromedriver unexpectedly exited. Status code was: 127\n", "errorType": "WebDriverException", "stackTrace": [ " File \"/var/task/lambda_function.py\", line 36, in lambda_handler\n driver = webdriver.Chrome(options=options, executable_path=chromedriver_path, desired_capabilities=d,)\n", " File \"/opt/python/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py\", line 70, in __init__\n super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], \"goog\",\n", " File \"/opt/python/lib/python3.8/site-packages/selenium/webdriver/chromium/webdriver.py\", line 89, in __init__\n self.service.start()\n", " File \"/opt/python/lib/python3.8/site-packages/selenium/webdriver/common/service.py\", line 98, in start\n self.assert_process_still_running()\n", " File \"/opt/python/lib/python3.8/site-packages/selenium/webdriver/common/service.py\", line 110, in assert_process_still_running\n raise WebDriverException(\n" ] }
I also started encountering this error when I upgraded from python 3.6 to 3.9. I did this because AWS deprecated 3.6. So I find the solution to downgrade to 3.7 troublesome, and it will only be a matter of time until 3.7 is deprecated as well.
I am running python script using selenium in aws lambda. I have created 2 layers 1 for selenium and 1 for chromedriver and headless-chromium. On execution I receive error
Response { "errorMessage": "Message: Service /opt/chromedriver unexpectedly exited. Status code was: 127\n", "errorType": "WebDriverException", "stackTrace": [ " File \"/var/task/lambda_function.py\", line 36, in lambda_handler\n driver = webdriver.Chrome(options=options, executable_path=chromedriver_path, desired_capabilities=d,)\n", " File \"/opt/python/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py\", line 70, in __init__\n super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], \"goog\",\n", " File \"/opt/python/lib/python3.8/site-packages/selenium/webdriver/chromium/webdriver.py\", line 89, in __init__\n self.service.start()\n", " File \"/opt/python/lib/python3.8/site-packages/selenium/webdriver/common/service.py\", line 98, in start\n self.assert_process_still_running()\n", " File \"/opt/python/lib/python3.8/site-packages/selenium/webdriver/common/service.py\", line 110, in assert_process_still_running\n raise WebDriverException(\n" ] }
I am using python version 3.8. Downloaded latest version v1.0.0-57 headless-chromium from https://github.com/adieuadieu/serverless-chrome/releases?page=1 ChromeDriver version for this chromium is https://chromedriver.storage.googleapis.com/index.html?path=86.0.4240.22/
I am using this tutorial for deploying to lambda https://dev.to/awscommunity-asean/creating-an-api-that-runs-selenium-via-aws-lambda-3ck3 This tutorial uses python3.6 but I wanted to use a newer version.
Posting my lambda function here
`from selenium import webdriver
from selenium.webdriver.chrome.options import Options
def lambda_handler(event, context):
print("Launching browser")
options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument("--no-sandbox")
options.add_argument("--log-level=1")
options.add_argument("--start-maximized")
options.binary_location = "/opt/headless-chromium"
chromedriver_path = "/opt/chromedriver"
driver = webdriver.Chrome(options=options, executable_path=chromedriver_path)
The text was updated successfully, but these errors were encountered: