google-chrome - ChromeDriver - 未知错误 : cannot find Chrome binary

标签 google-chrome selenium selenium-webdriver selenium-chromedriver

这是我的问题:使用 chrome 运行 Selenium 测试。

我这样做:

    ChromeOptions options = new ChromeOptions();
    options.setBinary("/Applications/Google/Google Chrome.app");
    System.setProperty("webdriver.chrome.driver", "/Users/Blabla/Documents/lib/chrome/chromedriver");

当我这样做时 mvn test ,我收到此错误:
    unknown error: cannot find Chrome binary

最佳答案

根据ChromeDriver Capabilities docs :

Path to the Chrome executable to use (on Mac OS X, this should be the actual binary, not just the app. e.g., '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome')



因此,您需要在 Finder 中找到您的应用程序并执行“显示包内容”

关于google-chrome - ChromeDriver - 未知错误 : cannot find Chrome binary,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35181740/

相关文章:

javascript - 我想构建一个 chrome 扩展,它将更新某些页面但没有任何弹出窗口

javascript - chrome 67 中的 getTime 不正确

javascript - 组织.openqa.selenium.JavascriptException : SyntaxError: '' string literal contains an unescaped line break while using executeScript through Selenium

c# - 使用 Webdriver 循环浏览页面上的每个链接

python - 遍历 send_keys 列表(Selenium 和 Python)

google-chrome - 启动 Chrome 并在启动时暂停 JS 脚本

javascript - Try Catch 不捕获 Chrome 中的语法错误

Python - 使用 Selenium 单击滚动到底部

java - webdriver,捕获@Test(超时= 10000)

java - Selenium 无法识别 IE 中新打开的浏览器上的元素