Search code examples
c#seleniumfirefoxselenium-webdrivergeckodriver

Is geckodriver required for Selenium 3.7 and Firefox ESR 52.4.1?


Is it my understanding that when using Selenium.WebDriver v3.7 from NuGet I require a current version of geckodriver in order to interact with Firefox ESR v52.4.1. However, I have managed to get tests running and successfully passing without geckodriver being involved at all.

I believe it is because I have enabled the legacy implementation option when instantiating the RemoteWebDriver, as illustrated below.

FirefoxOptions options = new FirefoxOptions
{
    UseLegacyImplementation = true,   // means that geckodriver is not required
    BrowserExecutableLocation = ...,  // ensures authorised Firefox version used
    Profile = ...                     // an instance of FirefoxProfile
};

RemoteWebDriver remoteWebDriver = new FirefoxDriver(options);

A number of questions to help me understand the details:

  1. Does this mean that Selenium.WebDriver is talking directly to the Firefox browser using the Marionette protocol?
  2. If so, does this setup rely on libraries currently distributed with the NuGet package that might be (will?) be dropped in a forthcoming release?
  3. If so, any idea which release or when that is likely to be?

Thanks!


Solution

  • Does this mean that Selenium.WebDriver is talking directly to the Firefox browser using the Marionette protocol?

    As per my understanding, when you set System.setProperty("webdriver.firefox.marionette", "false"); to false or do FirefoxOptions options = new FirefoxOptions() .setLegacy(true); that means it is using the legacy extension (not marionette and gecko) as described in firefox properties here

    Marionette can not be used without using gecko (or rather if you want to interact with gecko based browsers, you have to use marionette ). Marionette has a gecko component in it which is the marionette server as mentioned here

    geckodriver as it is written on github , provides an API to communicate with Gecko browsers

    This program provides the HTTP API described by the WebDriver protocol to communicate with Gecko browsers

    for selenium 3.0 onwards marionette is enabled by default as mentioned here

    For more info please refer to this question also

    If you are interested in learning more about marionette client-server-gecko interaction , have a look here

    EDIT:

    the source code of geckodriver states below points about geckodriver at different locations in readme.md

    1. geckodriver is a Proxy for using W3C WebDriver-compatible clients to interact with Gecko-based browsers.

    2. Selenium client bindings will pick up the geckodriver binary executable from your [system’s PATH environmental variable][PATH]

    3.Since geckodriver is a separate HTTP server that is a complete remote end implementation of [WebDriver], it is possible to avoid using the Selenium remote server

    1. geckodriver translates WebDriver [commands], [responses], and [errors] to the [Marionette protocol], and acts as a proxy between [WebDriver] and [Marionette]

    2. By default geckodriver tries to find and use the system installation of Firefox

    So , to answer your questions, this is how it all works

    Selenium language bindings reaches to -->geckodriver.exe finds -->system firefox installation(this can be changed though)reaches to inbuilt --> marionette client reaches to --> marionette server reaches to --> gecko engine of the browser which inturn calls out --> element.js,interaction.js,action.js,evaluate.js in gecko engine depending on what is being requested by the bindings or client.