What is the difference between WebDriver and DevTool protocol What is the difference between WebDriver and DevTool protocol selenium selenium

What is the difference between WebDriver and DevTool protocol


Main difference between WebDriver protocol and DevTools protocol is that WebDriver protocol needs a middle man like browser-driver (eg: chrome-driver) which is a server that sits between the automation script and browser enabling browser control, but in case of DevTools protocol the automation script can directly talk to browser running in debug mode making headless automation pretty straight forward.

And Chrome driver internally uses DevTools protocol to control browser, so if we are using WebDriver protocol it will in turn use Devtools protocol to control browser.

If cross-browser testing is something important for the new testing tool, DevTools protocol may not be suitable now, as there is no standard yet and it is mostly work in progress. Otherwise DevTools protocol will be a great choice as it gives more control like intercepting request header, simulating network etc and makes headless automation way easier.


WebDriver

WebDriver supplies us a well-designed object-oriented API that can provide improved support for modern advanced web-applications created through dynamic web pages. In short, WebDriver is the remote control interface that enables us to introspect and control the user agents. It provides us a platform and language neutral wire protocol along with as a way for out-of-process programs to remotely instruct the behavior of Web Browsers.

WebDriver Specification

The WebDriver Specification was published by the Browser Testing and Tools Working Group as Editor's Draft. Editor's Draft does not imply endorsement by the W3C Membership and may be updated, replaced or obsoleted by other documents at any time.

DevTools Protocol

The Developer Tools Protocol is used by various Browsers, JavaScript Engines and debugging tools to:

  • Help web developers with a set of diagnostics tools which work well across a variety of targets.
  • To converge the need for target-specific devtools protocol adapters and simplify the experience for tool users and tool developers.
  • Provide a vendor-neutral platform to facilitate collaboration and mutual consensus building between different protocol implementations and interested clients.
  • Reduce the engineering investment necessary to build any further compatible protocol implementations as per user stories.

Some of the Browser Engines and Browsers those have a built-in debugging protocol are:

Some of the adapters that exposes a common protocol:

Here you can find the list of adapters in RemoteDebug - Protocol Adaptors


1. Note that DevTools Protocol for Firefox is Work In Progress

2. Note that DevTools Protocol for Edge is Work In Progress