首頁  >  文章  >  後端開發  >  為什麼我在 Raspberry Pi 3 上使用 GeckoDriver 時會收到「WebDriverException:無效參數:無法終止已退出的進程」?

為什麼我在 Raspberry Pi 3 上使用 GeckoDriver 時會收到「WebDriverException:無效參數:無法終止已退出的進程」?

Patricia Arquette
Patricia Arquette原創
2024-10-27 05:56:02613瀏覽

  Why Am I Getting

WebDriverException:無效參數:無法在Raspberry Pi 3 上使用GeckoDriver、Selenium 和Python 終止已退出的程序

在具有Dietpi 的Raspberry Pi 3 上執行Firefox 並使用Geckodriver 進行測試的使用者可能會遇到以下錯誤:

selenium.common.exceptions.WebDriverException: Message: invalid argument: can't kill an exited process
解決方案:

要解決此錯誤,請按照以下步驟操作:

1.啟用無頭模式:

如果Firefox 在沒有顯示螢幕的系統上運行,請在程式碼中啟用無頭模式:

from selenium import webdriver
from selenium.webdriver.firefox.options import Options

options = Options()
options.headless = True
driver = webdriver.Firefox(options=options)
2.檢查相容性:

確保您擁有Firefox、Selenium 和Geckodriver的兼容版本。請參閱Mozilla 文件以了解支援的版本:

https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html

其他提示:

確保Geckodriver 可執行且位於GeckoDriverPath 變數指定的路徑中。
  • 如有必要,請重新啟動瀏覽器和 Web 伺服器。
  • 更新 Selenium 和 Geckodriver到最新版本。
  • 請參閱 Selenium 和 Geckodriver 文件以取得進一步的故障排除協助。

以上是為什麼我在 Raspberry Pi 3 上使用 GeckoDriver 時會收到「WebDriverException:無效參數:無法終止已退出的進程」?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn