簡體   English   中英

selenium.common.exceptions.WebDriverException:消息:未知錯誤:Chrome無法啟動:使用ChromeDriver Chrome和Selenium異常退出

[英]selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally with ChromeDriver Chrome and Selenium

我正在嘗試在linux服務器上運行webscraper。 完整錯誤如下

selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally 
(Driver info: chromedriver=2.10.267518,platform=Linux 4.4.0-141-generic x86_64)

我曾在stackoverflow上看到過類似的問題,解決方案包括“ --headless”和“ --no-sandbox”參數。 但是,我已經在這樣做了。

我可以在本地運行此代碼,但是無法在服務器上運行它。

我還檢查了一切,一切都是最新的。

ChromeDriver 2.10.267518
selenium     3.141.0

這是發生錯誤的代碼段。

options.add_argument('--headless')
options.add_argument('--no-sandbox')

caps = DesiredCapabilities.CHROME
caps['loggingPrefs'] = {'performance': 'ALL'}

driver = webdriver.Chrome(options=options, desired_capabilities=caps, executable_path='/usr/local/bin/chromedriver')

我也嘗試了不使用execute_path選項運行上述代碼,但仍然收到相同的錯誤。

此錯誤消息...

selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally 
(Driver info: chromedriver=2.10.267518,platform=Linux 4.4.0-141-generic x86_64)

...暗示ChromeDriver無法啟動/產生新的WebBrowser,Chrome瀏覽器會話。

您的主要問題是所使用的二進制版本之間的不兼容性 ,如下所示:

  • 您正在使用chromedriver = 2.10
  • chromedriver = 2.10發行說明明確提到以下內容:

支持Chrome v33-36

  • 可能您正在使用最新的chrome = 72.0
  • ChromeDriver v2.46的發行說明中明確提到以下內容:

支持Chrome v71-73

因此, ChromeDriver v2.10Chrome瀏覽器v72.0之間存在明顯的不匹配


  • 升級ChromeDriver當前ChromeDriver v2.46水平。
  • 保持Chrome版本介於Chrome v71-73之間。 根據ChromeDriver v2.45發行說明
  • 通過IDE 清理 項目工作區 ,並僅使用必需的依賴項重建項目。
  • 如果您的基本Web客戶端版本太舊,則將其卸載並安裝最新的GA和發行版本的Web Client
  • 進行系統重啟
  • 執行您的@Test

我正在使用將標頭值設置為True的配置文件,因此代碼試圖在瀏覽器上運行並失敗。 這是一個愚蠢的錯誤,但是無論如何我都會發布解決方案,以防它對某人有所幫助。

我還必須刪除下面的行

options.add_argument('--no-sandbox')

並更改此行

options.add_argument('--headless')

options.add_argument('headless')

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

相關問題 TDD-Django(部署)錯誤:selenium.common.exceptions.WebDriverException:消息:未知錯誤:Chrome無法啟動:異常退出 selenium.common.exceptions.WebDriverException:消息:未知錯誤:Chrome 無法啟動:異常退出。 Dockerize Flask 應用程序 selenium.common.exceptions.WebDriverException:消息:未知錯誤:Chrome 無法啟動:在 Python 中使用 ChromeDriver 和 Selenium 崩潰 selenium.common.exceptions.WebDriverException:消息:未知錯誤:無法使用 ChromeDriver Chrome Selenium 創建 Chrome 進程錯誤 selenium.common.exceptions.WebDriverException:消息:未知錯誤:無法使用帶有Selenium Python的ChromeDriver Chrome創建Chrome進程 WebDriverException:消息:未知錯誤:Chrome 無法啟動:使用 ChromeDriver Chrome 和 Selenium Python 異常退出錯誤 selenium.common.exceptions.WebDriverException:消息:未知錯誤:Chrome無法以Selenium和RaspberryPi上的Chrome啟動 WebDriverException:消息:未知錯誤:Chrome 無法啟動:通過 VPS 上的 Python 使用 ChromeDriver Chrome 和 Selenium 異常退出 WebDriverException:消息:未知錯誤:Chrome 無法啟動:通過 WebDriverManager 使用 Selenium ChromeDriver 和 Chrome 異常退出 WebDriverException:消息:未知錯誤:Chrome 無法啟動:在 debian 服務器上使用 ChromeDriver Chrome 和 Selenium 異常退出
 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM