Monday 16 October 2017

Why there is no need of external Firefox driver like IE and chrome in selenium2.0..?

Answer:
Firefox driver is included in the selenium-server-stanalone.jar available in the downloads. The driver comes in the form of an .xpi (Firefox extension) which is added to the Firefox profile when you start a new instance of Firefox Driver.

How the Safari driver works:
Ø  The Safari Driver is implemented as a Safari browser extension. The driver inverts the traditional client/server relationship and communicates with the Webdriver client using Web Sockets.
Ø  It is just an extension that is created and used to communicate with Firefox, the other browsers & drivers simply don't follow the same implementation and thus, you are required to start drivers & executables for the others.
How IE Driver Works:
The IEDriver uses very low-level Win32 API calls to do some of it’s work, the Firefox Driver or Chrome driver doesn't need to do this
How Gecko Driver Works:
Ø  Gecko Driver is the link between your tests in Selenium and the Firefox browser.
Ø  Gecko Driver is a proxy for using W3C Webdriver-compatible clients to interact with Gecko-based browsers i.e. Mozilla Firefox in this case.
Ø  As Selenium 3 will not have any native implementation of FF, we have to direct all the driver commands through Gecko Driver.
Ø  Mozilla has created the gecko driver binary for use with Firefox v48 and later.
NOTE: If using Firefox v47 and earlier then the following can be ignored as it uses the native Firefox browser implementation.

In order for Selenium to hook into Firefox the Geckodriver Binary Path System Property must be set before instantiating the WebDriver.
webdriver.gecko.driver = path/to/geckodriver
The following is sets the property in Java.
System.setProperty("webdriver.gecko.driver","path/to/geckodriver");
WebDriver driver = new FirefoxDriver();
As of 2017-03 the latest Geckodriver must be used with Selenium v3.3 and later.

Ø  The reason for initializing the InternetExplorerDriver and Chromedriver is that each have specific browser options.
Also, the other reason for a driver binary is that Selenium does not have native implementations of the browser events that are part of Internet Explorer, Chrome and Firefox (as of v48 and later).

A logical assumption is that Selenium never had native events for Internet Explorer or Chrome previously and that is why it has been required to use the specific driver binary for each browser type.



0 comments:

Post a Comment