在没有 chrome 的构建代理上使用 Chrome 驱动程序进行 Selenium 测试

Selenium tests with Chrome driver on build agent without chrome

我们有一套 Selenium tests in c# project xunit。 我们使用 headless chrome 并且测试 运行 在安装了 Chrome 的 PC 上很好。

但是,在构建代理上我们没有 Chrome,因此我们收到异常 cannot find Chrome binary

有什么方法可以在测试项目中将 Chrome 作为独立的 exe 发布,这样我们就不必在服务器上安装它了吗? 还有其他建议吗?

有一个选项可以通过便携式 Chromium 包实现您想要的东西

within test project as a standalone exe

基本步骤是:

  • their page

  • 下载所需版本
  • 解压

  • 运行 chrome.exe

便携式浏览器的主要优点是您可以将它与您的项目一起带到任何地方,避免安装和涉足 windows 注册表。

Chromium 确实是 Chrome 本身的开源版本,但与 Chrome 一样高效。请记住,Flash 和 PDF 存在一些功能差异。