carlosonunez / firefox-lambda

Run Firefox on Lambda!
4 stars 0 forks source link

This is still working? im tryng to run this in lambda but have error 255 #3

Open Arwiim opened 2 years ago

Arwiim commented 2 years ago

this is my .py

` from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.firefox.options import Options as FirefoxOptions from selenium.webdriver.common.keys import Keys from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

class VtexRobot():

  def __init__(self) -> None:
      binary = FirefoxBinary('/opt/tmp/firefox/firefox')
      ex = '/usr/local/bin/geckodriver'
      options = FirefoxOptions()
      options.add_argument('--headless')
      options.add_argument('--no-sandbox')
      options.add_argument('--disable-dev-shm-usage')
      self.driver = webdriver.Firefox(firefox_binary=binary,
                                      executable_path='/opt/usr/local/bin/geckodriver',
                                      log_path='/tmp/geckodriver.log',
                                      options=options)

def lambda_handler(event, context):
  vtex = VtexRobot()

` When i run this i have the followin message

Response { "errorMessage": "Message: Process unexpectedly closed with status 255\n", "errorType": "WebDriverException", "stackTrace": [ " File \"/var/task/lambda_function.py\", line 33, in lambda_handler\n vtex = VtexRobot()\n", " File \"/var/task/lambda_function.py\", line 27, in __init__\n self.driver = webdriver.Firefox(firefox_binary=binary,\n", " File \"/opt/python/lib/python3.8/site-packages/selenium/webdriver/firefox/webdriver.py\", line 170, in __init__\n RemoteWebDriver.__init__(\n", " File \"/opt/python/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py\", line 157, in __init__\n self.start_session(capabilities, browser_profile)\n", " File \"/opt/python/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py\", line 252, in start_session\n response = self.execute(Command.NEW_SESSION, parameters)\n", " File \"/opt/python/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py\", line 321, in execute\n self.error_handler.check_response(response)\n", " File \"/opt/python/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py\", line 242, in check_response\n raise exception_class(message, screen, stacktrace)\n" ] }

carlosonunez commented 2 years ago

Hey there! Thank you for using this project!

Unfortunately I haven't tested firefox-lambda in many years, so I can't say with certainty why you're experiencing this error. However, the options that you've provided to the FirefoxDriver are for Chrome, not Firefox.