In Selenium how does ChromeDriver executable finds

2019-07-23 05:19发布

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

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

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

Responses appreciated!!

2条回答
Juvenile、少年°
2楼-- · 2019-07-23 05:24

As per the Requirements of 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.

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

Chrome_binary_expected_location

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:

Chrome executable in a non-standard location

查看更多
聊天终结者
3楼-- · 2019-07-23 05:24

Google chrome doesn't have built-in driver server, so you need to install ChromeDriver so that the selenium code communicates with the chrome browser.This ChromeDriver implements webdriver's wire protocol (client being system on which webdriver API is used & server being browser acting as/containing stand alone server). For Internet explorer one needs to install InternetExplorerDriver as stand alone server. For Selenium 3.0 & above to work with firefox, Geckodrver has to be installed.

查看更多
登录 后发表回答