iT邦幫忙

0

selenium Chrome webdriver 開啟失敗

本來python程式碼(spyder)是可以正常開啟Chrome webdriver的,運作也沒問題。但某天升級conda跟spyder之後,接下來用python程式碼開啟Chrome webdriver的時候,便會出現開啟chrome後瞬間關閉,出現失敗訊息:
unknown error: Chrome failed to start: crashed.
(chrome not reachable)
(The process started from chrome location C:\Program Files (x86)\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.),

但是如果換台電腦把原始程式碼,利用pyinstaller打包程執行檔後,再複製到原先不能執行的電腦上,卻仍是可以執行的,所以應該不是瀏覽器的路徑或driver版本不符的問題。

接下來看網路上資料,說可以dump執行瀏覽器的錯誤過程,也將它紀錄下來,發現以下錯誤:

[1631516639.631][DEBUG]: DevTools HTTP Request: http://localhost:51072/json/version
[1631516641.635][DEBUG]: DevTools HTTP Request failed
[1631516641.647][INFO]: [6d917d61836338d44a37e8436fbc403e] RESPONSE InitSession ERROR unknown error: Chrome failed to start: crashed.
(chrome not reachable)
(The process started from chrome location C:\Program Files (x86)\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
[1631516641.647][DEBUG]: Log type 'driver' lost 0 entries on destruction
[1631516641.647][DEBUG]: Log type 'browser' lost 0 entries on destruction

請問有前輩知道該如何解決這個問題呢? 這困擾我很久了,先感恩前輩們的幫忙。

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答