在 Selenium 中,ChromeDriver 可执行文件如何找到 Chrome 浏览器?

2024-04-27

对于Selenium,我们在System.setProperty中定义chrome可执行路径。当在 driver.get 中传递 URL 且 Chrome 调用时:

1 - chrome 可执行文件如何知道 Chrome 浏览器的实际安装位​​置?

2 - 如果我没有 Chrome 浏览器会怎样?

回复表示赞赏!


根据要求 https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver#requirements of Chrome驱动程序:

The Chrome驱动程序由三个独立的部分组成。有浏览器本身,即chrome,Selenium 项目提供的语言绑定,即driver以及从 Chromium 项目下载的可执行文件,它充当之间的桥梁chromedriver。该可执行文件称为铬驱动程序,我们一般将其称为server以减少混乱。

服务器期望您已安装 Chrome默认位置对于每个系统,如下图所示:

1For Linux systems, the ChromeDriver expects /usr/bin/google-chrome to be a symlink to the actual Chrome binary. In case you are using a Chrome executable in a non-standard location you have to override the Chrome binary location. as follows:

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 Selenium 中,ChromeDriver 可执行文件如何找到 Chrome 浏览器? 的相关文章

随机推荐