Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between WebDriver and DevTool protocol

As we known WebDriver protocol is design for automation test purpose. But the major browsers also provide DevTool protocol. In some cases the DevTool protocol could achieve more powerful interactions and operations compare to WebDriver.

My question is why there are two different protocols and what's the main difference between these two protocols? Is there any selection experience available to share for a project development?

Thanks in advance!

Reference:

  • DevTools

    • https://docs.microsoft.com/en-us/microsoft-edge/devtools-protocol/
    • https://chromedevtools.github.io/devtools-protocol/
    • https://searchfox.org/mozillacentral/source/devtools/docs/backend/protocol.md
  • WebDriver:

    • https://www.seleniumhq.org/projects/webdriver/
    • https://www.w3.org/TR/webdriver1/
    • https://docs.microsoft.com/en-us/microsoft-edge/webdriver
    • https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver
    • https://sites.google.com/a/chromium.org/chromedriver/downloads
like image 356
Erxin Avatar asked Jun 20 '18 01:06

Erxin


2 Answers

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.

like image 127
par Avatar answered Sep 28 '22 06:09

par


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:

  • Chrome DevTools
  • WebKit / Safari
  • Node.js
  • Firefox 1 (in development)
  • Edge 2 ([in development] (link will be updated soon))

Some of the adapters that exposes a common protocol:

  • Microsoft Edge Diagnostics Adapter - will be replaced by the native support (mentioned above).
  • RemoteDebug iOS WebKit Adapter

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

like image 35
undetected Selenium Avatar answered Sep 28 '22 07:09

undetected Selenium