5

The WebDriver API allows browsers to be automated, such as for end-to-end testing. Specific implementations exist, such as the standalone ChromeDriver or InternetExplorer Driver executables or the FireFoxDriver extension. These implementations take commands sent over the JSON Wire Protocol. Please correct this if I'm wrong.

My questions is two-fold:

  1. What protocol do the WebDriver implementations use to talk to the browser?
  2. Why don't browsers implement the JSON Wire Protocol directly? It seems that the WebDriver bit must implement both JSON Wire and whatever protocol it uses to talk to that browser, and then the browser must implement that protocol as well. This seems like a considerable duplication of effort.

The argument that browser size should be minimized seems relatively weak, since browsers have to implement the latter protocol anyway.

The Selenium docs claim that

[the term "server"] may also refer to a specific browser that implements the wire protocol directly, such as the FirefoxDriver or IPhoneDriver

That doesn't make sense - FirefoxDriver isn't a browser. As far as I can tell, it's an XPI extension for Firefox.

UPDATE: I've asked the question on the Selenium Developers mailing list and it seems that the WebDriver-browser protocols are undocumented and vendor-specific.

3
  • It seems that some browsers... ? I think you didnt finish your sentence.. :) Commented Aug 6, 2015 at 7:23
  • @Niels: sorry, fixed. Commented Aug 6, 2015 at 10:09
  • The way Selenium talks to browsers is vendor (well, application) specific. The WebDriver language APIs and the Wire API are, thanks to the multiple application specific servers, not application specific and that is their raison d'etre.. Is this what you wanted to find out? Perhaps your update could be your answer?
    – Paul Hicks
    Commented Oct 6, 2015 at 0:00

1 Answer 1

5

The JSON Wire Protocol is on it's way to becoming accepted as a W3C standard. This means that moving forward, the vendors behind browsers will have much more incentive to implement and maintain implementations for their browsers. Some vendors such as Mozilla and Microsoft have already taken over maintenance of the drivers used by Firefox and Edge. I heard google has declared intent to take over chromedriver, but theres no real ETA for that. Each vender implements the wire protocol their own way.

One reason why browsers do not currently implement this protocol directly is because it's not a universally accepted standard yet, and thus, venders simply don't know if the effort they put into integrating and maintaining it will be sustainable.

Historically (I'm not sure if this is still the case), Firefox's implementation was a firefox plugin that would be installed in a new, disposable profile which ran a lightweight HTTP server that would receive commands and perform javascript operations accordingly.

The JSON wire protocol uses JSON as the name implies to package commands and uses HTTP to send those messages to whatever http server is ready to recieve them. This gives near universal support as most technologies these days utilize and can understand these protocols.

https://www.w3.org/TR/webdriver/

Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.