為了改善您的使用體驗,本網站正在進行維護,部分功能暫時無法使用。若本站的文件無法解決您的問題,想要向社群發問的話,請到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 發問,我們的社群成員將很快會回覆您的疑問。

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

Running Firefox on read-only file system

more options

I'm trying to run Firefox on headless mode through Selenium in AWS Lambda. Since Lambda marks the root file system as read-only except /tmp/. I pointed the geckodriver to write the logs to /tmp but still Firefox is not starting up and it's failing with the following error.

Any guidance on how to get it working?

firefox_driver = webdriver.Firefox(firefox_profile=ff_profile, firefox_binary='/opt/firefox/firefox', options=firefox_options, service_log_path='/tmp/geckodriver.log')

 File "/var/lang/lib/python3.8/site-packages/selenium/webdriver/firefox/webdriver.py", line 170, in __init__
   RemoteWebDriver.__init__(
 File "/var/lang/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
   self.start_session(capabilities, browser_profile)
 File "/var/lang/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
   response = self.execute(Command.NEW_SESSION, parameters)
 File "/var/lang/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
   self.error_handler.check_response(response)
 File "/var/lang/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
   raise exception_class(message, screen, stacktrace)
I'm trying to run Firefox on ''headless'' mode through Selenium in AWS Lambda. Since Lambda marks the root file system as read-only except ''/tmp/''. I pointed the geckodriver to write the logs to ''/tmp'' but still Firefox is not starting up and it's failing with the following error. Any guidance on how to get it working? firefox_driver = webdriver.Firefox(firefox_profile=ff_profile, firefox_binary='/opt/firefox/firefox', options=firefox_options, service_log_path='/tmp/geckodriver.log') File "/var/lang/lib/python3.8/site-packages/selenium/webdriver/firefox/webdriver.py", line 170, in __init__ RemoteWebDriver.__init__( File "/var/lang/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__ self.start_session(capabilities, browser_profile) File "/var/lang/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/var/lang/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/var/lang/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace)

被選擇的解決方法

By setting HOME=/tmp I'm able to circumvent this problem.

從原來的回覆中察看解決方案 👍 0

所有回覆 (2)

more options

選擇的解決方法

By setting HOME=/tmp I'm able to circumvent this problem.

more options

Hi Prakash, What were the other firefox options you used? I tried setting the HOME variable and the error still reoccured!