chetan
chetan

Reputation: 65

why we need to download browser(IE,Chrome) drivers

In order to execute test scripts on diff browsers, we download specific browser driver from seleniumhq.com and run the scripts.

This code works fine as it should:

System.setProperty("webdriver.ie.driver", "C:\\Users\\Public\\CIO\\resources\\iedriver.exe");

WebDriver driver = new InternetExplorerDriver();
driver.get("www.mywebsite.com");

When I already have IE Executable -'iexplore.exe' on my machine, can't selenium webdriver use that to launch IE?

Why do we specifically download IEDriver from seleniumhq.com here?

C:\Program Files\Internet Explorer\iexplore.exe

I tried to even setup that up and ran the program. Browser got launched with address as --port=1234/ however it could not navigate to respective website and eventually threw exception:

Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Build info: version: '2.28.0', revision: '18309', time: '2012-12-11 20:21:18'

Upvotes: 4

Views: 4247

Answers (1)

Yosef Weiner
Yosef Weiner

Reputation: 5751

The "Browser Drivers" are servers that implement the WebDriver's wire protocol, and know how to convert those commands into the specific browser's proprietary native API.

The WebDriver site explains:

Selenium-WebDriver makes direct calls to the browser using each browser’s native support for automation. How these direct calls are made, and the features they support depends on the browser you are using.

For example, the ChromeDriver wiki describes it as follows:

The ChromeDriver consists of three separate pieces. There is the browser itself ("chrome"), the language bindings provided by the Selenium project ("the driver") and an executable downloaded from the Chromium project which acts as a bridge between "chrome" and the "driver".

Essentially, the browser doesn't know how to "talk" WebDriver Wire Protocol, and the WebDriver doesn't know how to "talk" Browser API. In fact, each Browser has its own native API. The "browser driver" knows how to interpret the Wire Protocol and invoke that browser's API.

Upvotes: 7

Related Questions