錯誤
- 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
