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
posted @ 2022-03-21 19:08  话·醉月  阅读(941)  评论(0编辑  收藏  举报