Selenium 3.7 和 Firefox ESR 52.4.1 是否需要 geckodriver?

Is geckodriver required for Selenium 3.7 and Firefox ESR 52.4.1?

据我了解,在使用来自 NuGet 的 Selenium.WebDriver v3.7 时,我需要当前版本的 geckodriver 才能与 Firefox ESR v52.4.1 交互。但是,我已经设法获得测试 运行 并成功通过 而没有 geckodriver 参与。

我认为这是因为我在实例化 RemoteWebDriver 时启用了遗留实施选项,如下图所示。

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);

一些帮助我理解细节的问题:

  1. 这是否意味着 Selenium.WebDriver 正在使用 Marionette 协议直接与 Firefox 浏览器对话?
  2. 如果是这样,此设置是否依赖于当前与 NuGet 包一起分发的库,这些库可能(将?)在即将发布的版本中删除?
  3. 如果是这样,知道可能是哪个版本或什么时候发布吗?

谢谢!

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

据我了解,当您将 System.setProperty("webdriver.firefox.marionette", "false"); 设置为 false 或执行 FirefoxOptions options = new FirefoxOptions() .setLegacy(true); 时,这意味着它正在使用 firefox 属性中描述的旧版扩展(不是 marionette 和 gecko) here

Marionette 不能在不使用 gecko 的情况下使用(或者更确切地说,如果你想与基于 gecko 的浏览器交互,你必须使用 marionette )。 Marionette 中有一个 gecko 组件,它是提到的 marionette 服务器 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

对于 selenium 3.0 及更高版本 marionette 默认启用 here

更多信息请参考问题

如果您有兴趣了解有关 marionette 客户端-服务器-gecko 交互的更多信息,请查看 here

编辑:

geckodriver 的 source code 在 readme.md

的不同位置陈述了以下关于 geckodriver 的要点
  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

所以,为了回答您的问题,这就是它的工作原理

Selenium 语言绑定 reaches to -->geckodriver.exe finds --> 系统 firefox 安装(虽然可以更改)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被绑定或客户端请求。