使用 Selenium 时 JsonWireProtocol 机制与 W3C Living Document 中新标准的区别

Difference between JsonWireProtocol mechanisms and the new standards in W3C Living Document when using Selenium

我想知道 JsonWireProtocol 中的机制(状态:OBSOLETE)和 2019 年 12 月 31 日的 W3C 动态文档(新标准) 使用 Selenium 进行 UI 测试时。我知道 Selenium 使用了以下内容: 当我们创建驱动程序 (C#) 的新实例时:

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
IWebDriver driver = new ChromeDriver();

我们实际上向 selenium 服务器发出了一个 POST /session 请求。 之后通过 JsonWireProtocol,例如:

POST /session/:sessionId/element/:id/click,我们可以找到并点击特定的元素,或者制作一些其他的与其他请求的操作...

那么现在有哪些新鲜事物呢?有人可以解释新标准吗?!如果有人深入研究,我会很高兴!

WebDriver W3C Living Document 31 December 2019

JsonWireProtocol

WebDriver 有线协议

初始 WebDriver Wire Protocol draft was a proposal that, all implementations of WebDriver that would communicate with the browser, or a RemoteWebDriver server shall use a common wire protocol. This wire protocol defined a RESTful web service using JSON 通过 HTTP。

根据最初的提议和实践,一些 JSON 对象如下:

  • WebElement JSON Object:WebElement 的 JSON 表示,用于通过网络传输。该对象将具有以下属性:

  • Capabilities JSON Object:并非所有服务器实现都支持每个 WebDriver 功能。因此,在描述会话支持哪些功能时,客户端和服务器应使用具有下列属性的 JSON 对象。
  • Desired Capabilities: A Capabilities JSON Object sent by the client describing the capabilities a new session created by the server should possess. Any omitted keys implicitly indicate the corresponding capability is irrelevant. More at DesiredCapabilities.
  • Actual Capabilities:服务器返回的能力 JSON 对象,描述会话实际支持的功能。任何省略的键都隐含地表示不支持相应的功能。
  • 等等

WebDriver W3C 规范

随着 WebDriver W3C Specification 的引入,定义了以下标准:

  • WebDriver 远程端必须提供符合 HTTP 的线路协议,其中 端点 映射到不同的命令。
  • 虽然该标准只定义了远端协议,但对本端如何实现没有要求。
  • 本地端只能在可以说远端协议的范围内兼容;对他们暴露的面向用户的 API.
  • 没有任何要求

命令

WebDriver 协议被组织成命令。每个具有本规范中定义的方法和模板的 HTTP 请求都代表一个命令,因此每个命令都会产生一个 HTTP 响应。作为对命令的响应,远程端将 运行 一系列称为远程端步骤的操作。这些提供了远程端在收到特定命令时所采取的操作序列。


端点

下面的 table 端点列出了每个端点节点命令的方法和 URI 模板及其 current support in

结尾