Is geckodriver required for Selenium 3.7 and Firefox ESR 52.4.1?

风流意气都作罢 提交于 2019-12-10 10:01:35

问题


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!


回答1:


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 because 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.



来源:https://stackoverflow.com/questions/47185262/is-geckodriver-required-for-selenium-3-7-and-firefox-esr-52-4-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!