What is JSON wire protocol in selenium?

SeleniumAutomation TestingTesting Tools

To understand we need to first have a fair idea of what JSON actually is, JSON stands for Java Script Object Notation. Now let's have a look at what a sample JSON input looks like −

   "name": "Tutorials Point",
   "topic": "Selenium",
   "Address": "India"

JSON today is one of the most widely used and accepted method for communication of heterogeneous system. JSON is used a lot in web services in REST and has been a strong competition to XML.

Let’s understand how Web driver uses it when testing the web applications −

WebDriver uses JSON as a medium to communicate between client libraries (Java, C#, Python and so on) and drivers (Firefox Driver, IE Driver, Chrome Driver). The request is to in the form an HTTP request which accepts input in the form of JSON. The operations are performed and the response of execution is shared back to the client in the form of JSON. Similarly, the RemoteWebDriver client and the RemoteWebDriver server use the JSON wire protocol to communicate among themselves.

To sum up, lets see how it works in a step by step manner −

  • In a server-client architecture it is necessary that the client and server should be in sync and are able to receive and send the request and response.

  • As the name suggests JSON(JavaScript Object Notation) is used to represent objects with complex data structures. JSON wire protocol acts as a mediator between client libraries and WebDrivers. It sends transfers data between the client and the server on the web.

  • The server doesn’t understand the programming language in which the program is created, it just understands the protocol, and here comes the role of JSON wire Protocol.

  • It uses the process of serialization(convert Object’s data to JSON Format) and de-serialization(convert JSON format to object) just like REST web services.

Note − JSON Wire Protocol is obsolete now and no longer used.

Updated on 30-Jul-2019 22:30:26