在Selenium中,ChromeDriver可执行文件如何找到Chrome浏览器? [英] In Selenium how does ChromeDriver executable finds Chrome browser?

查看:617
本文介绍了在Selenium中,ChromeDriver可执行文件如何找到Chrome浏览器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

For Selenium, we define the chrome executable path in System.setProperty. When a URL is passed in driver.get and Chrome invokes:

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

1 - How does chrome executable know where Chrome browser is actually installed?

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

2 - What would happen if I do not have Chrome browser?

感谢回复!

推荐答案

根据 ChromeDriver 要求 :

ChromeDriver 由三部分组成.有浏览器本身,即 chrome ,Selenium项目提供的语言绑定(即驱动程序)和从Chromium项目下载的可执行文件,可作为之间的桥梁chrome 驱动程序.此可执行文件称为 chromedriver ,我们通常将其称为服务器,以减少混乱.

The ChromeDriver consists of three separate pieces. There is the browser itself i.e. chrome, the language bindings provided by the Selenium project i.e. the driver and an executable downloaded from the Chromium project which acts as a bridge between chrome and the driver. This executable is called the chromedriver, we generally refer to it as the server to reduce confusion.

服务器希望您按照以下图片在每个系统的默认位置中安装Chrome:

The server expects you to have Chrome installed in the default location for each system as per the image below:

1 对于Linux系统,ChromeDriver希望/usr/bin/google-chrome是实际Chrome二进制文件的符号链接.如果您在非标准位置使用 Chrome 可执行文件,则必须覆盖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:

这篇关于在Selenium中,ChromeDriver可执行文件如何找到Chrome浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆