Java selenium錯誤——org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary


錯誤

  • org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary

背景

  • Java一個項目,使用selenium打開chrome瀏覽器,進行系統截圖。

原因

  • ubuntu系統下未安裝chrome。
    • 先前一直以為Chrome Driver二進制文件中是實現Chrome內核的,使用selenium打開chrome時,系統是不需要安裝chrome的
    • 經過驗證,Chrome Driver二進制只是調用Chrome,自身是不具有Chrome瀏覽器功能的

解決方法

  • ubuntu系統進行Chrome安裝
    • sudo  wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
    • sudo apt install ./google-chrome-stable_current_amd64.deb


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM