Developers started to build very rich and interactive experiences on the web. YouTube and Google Map are some very good, early examples of this. With smartphones coming into the picture, needs for test automation increased because suddenly there was a requirement for cross-browser and cross-device compatibility. Selenium and the WebDriver project were born to solve the test automation challenges.
At that time it was common to write Selenium tests in Java. In 2009, Node.js brought JavaScript development to the backend. Also, it enabled running tests written in JavaScript. More JavaScript frameworks came into the picture. At the same time, Selenium and WebDriver merged into a single Selenium-WebDriver project. With the growing popularity, the project became a W3C standard in 2018, and we call it WebDriver Classic.
With more developers building richer applications in JavaScript, these developers also wanted to perform test automation in JavaScript as well. Multiple web-based JavaScript testing libraries are introduced to address the needs, and not all of them use WebDriver as the underlying automation technology. They are using different techniques to automate the browser, which we are going to talk about today. We will cover the WebDriver Protocol, supported by solutions like Selenium, Nightwatch.js, or WebDriverIO, the Chrome DevTools Protocol, CDP in short, powering Puppeteer, Chrome's own automation library, and PlayWrite, and Web APIs plus browser extensions, leveraged by Taskcafe or Cypress, for example.
Let's start and take a step back and talk about how tools automate browsers. I mentioned three major ways to automate a browser. Well, they fall into two major categories, too. Let's intensify the complexity a bit, because we have high level, which executes JavaScript injected into the browser, and low level, which executes remote commands. For example, Cypress utilizes browser extensions and Node.js to execute a test directly in the browser. To gain greater control of the browser, like opening multiple tabs, and testing for party iframes, we need to go deeper and execute remote commands. With other techniques, and let's call it simply protocols. The two common protocols are WebDriver, Chrome, and DevTools protocol, Cpp in short. We will explore all of this together shortly. No worries. I'm going to start with the approach to use web APIs and browser extensions to build your own automation layer. Essentially the solutions leverage and launch of web APIs, JS injection, browser extensions, proxies, etc., to build their very own automation layer. Going into detail here would burst the talk, size of the talk. So I'm going to stop here and segue over to WebDriver, the automation technique built upon standard. It's one of the low level protocols. So let's take a brief look how they work in principle.
Comments