使用 Selenium 时 JsonWireProtocol 机制与 W3C Living Document 中新标准的区别 [英] Difference between JsonWireProtocol mechanisms and the new standards in W3C Living Document when using Selenium

查看:19
本文介绍了使用 Selenium 时 JsonWireProtocol 机制与 W3C Living Document 中新标准的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道 JsonWireProtocol (Status: OBSOLETE) 和 2019 年 12 月 31 日起的 W3C Living Document(新标准)中的机制有什么区别?用于 UI 测试的硒.我知道 Selenium 使用了以下内容:当我们创建一个驱动程序的新实例(C#)时:

使用OpenQA.Selenium;使用 OpenQA.Selenium.Chrome;IWebDriver 驱动程序 = new ChromeDriver();

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

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

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

  • 尾声

    两者有什么区别协议和 Json Wire 协议

    I'm wondering what are the differences between the mechanisms in JsonWireProtocol (Status: OBSOLETE) and W3C Living Document from 31 December 2019 (the new standard) when using Selenium for UI tests. I know that Selenium have used the following: When we make a new instance of a driver (C#):

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

    we actually make a POST /session request to the selenium server. After that via JsonWireProtocol and, in example:

    POST /session/:sessionId/element/:id/click, we can find and click on particular element, or make some other actions with the other requests...

    So what are the new things nowadays? Can someone explain the new standard?! I will be very happy if someone do that in-depth!

    WebDriver W3C Living Document 31 December 2019

    JsonWireProtocol

    解决方案

    The WebDriver Wire Protocol

    The initial 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 over HTTP.

    As per the initial proposal and practice some of the JSON Objects were as follows:

    • WebElement JSON Object: The JSON representation of a WebElement for transmission over the wire. This object will have the following properties:

    • Capabilities JSON Object: Not all server implementations will support every WebDriver feature. Therefore, the client and server should use JSON objects with the properties listed below when describing which features a session supports.
    • 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: A Capabilities JSON Object returned by the server describing what features a session actually supports. Any omitted keys implicitly indicate the corresponding capability is not supported.
    • etc

    WebDriver W3C Specification

    With the introduction of WebDriver W3C Specification the following standards were defined:

    • WebDriver remote ends must provide an HTTP compliant wire protocol where the endpoints map to different commands.
    • Though this standard only defines the remote end protocol, it puts no demands to how local ends should be implemented.
    • Local ends are only expected to be compatible to the extent that they can speak the remote end’s protocol; no requirements are made upon their exposed user-facing API.

    Commands

    The WebDriver protocol is organised into commands. Each HTTP request with a method and template defined in this specification represents a single command, and therefore each command produces a single HTTP response. In response to a command, a remote end will run a series of actions known as remote end steps. These provide the sequences of actions that a remote end takes when it receives a particular command.


    Endpoints

    The table of endpoints below lists the method and URI template for each endpoint node command and their current support in ChromeDriver.

    Outro

    What is the difference between Protocol and Json Wire Protocol

    这篇关于使用 Selenium 时 JsonWireProtocol 机制与 W3C Living Document 中新标准的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆