Tools from Chrome for frictionless, automated testing

Testing is important. It's a key step before delivering what you have built to users—whether that's an entire site or application, or a new feature—to check that it works as expected. However, a lot of testing still happens manually, with colleagues or test engineers asked to check out the new feature and report problems.

Matthias Rohmer
Matthias Rohmer

While this manual testing can show up certain classes of issues, it can miss many more. The people doing the testing may miss edge cases, or completely fail to test a particular journey through the app. They also don't have all of the information you had when writing the code, they don't know about the specific issues you included code to prevent. And, as time passes, and new features are added, will they go back and retest all of those previously working things, to make sure the changes haven't broken them?

That's why the Chrome team believes in the importance of automated testing. By using a test suite that reliably and repeatedly tests your feature for breakage, you can be sure that every small detail is tested, now and after future development. Your knowledge as the developer of a feature is encapsulated in a test.

However, we know that automated testing can be challenging. That's why the Chrome team provides the following tools and guidance to make it as frictionless as possible for you.

Puppeteer

Puppeteer is a Node.js library. It lets you automate Chrome, Chromium, and Firefox with an easy-to-use, high-level API.

While this API was originally based on the Chrome DevTools Protocol, the aim is to make the new, advanced WebDriver BiDi protocol the foundation of Puppeteer by the end of the year. WebDriver BiDi, co-created by all major browser vendors, simplifies a lot of automation use cases and enables a lot of new ones, and is cross-browser compatible.

But there is no need to wait. Puppeteer's API already enables a lot of automation use cases today, which will only improve with WebDriver BiDi. From testing, to visual crawling, and process automation there is a lot you can do with features like page interactions, request interception, and screenshots. You can even use it to test your web AI models in the cloud using WebGPU and WebGL.

Puppeteer is also used by tools like WebdriverIO, a full-fledged browser testing framework, and the Privacy Sandbox Analysis Tool, allowing you to better understand cookie and user data usage on your site.

Chrome Headless

If you've ever automated Chrome using Puppeteer you might have discovered there's no browser window displayed as the tests run. By default Puppeteer starts Chrome in Headless mode. This means there is no actual browser window while your automation is running.

But did you know that Chrome's Headless mode was not just Chrome-without-a-window, but actually a completely separately maintained version of Chrome? For a long time that led to confusion and hard to trackdown bugs and problems.

From Chrome 112 we introduced a new Headless mode, now based on the same codebase as regular Chrome. This doesn't just reduce previous confusion but also brings functionality that wasn't possible before, like using extensions during automation.

Puppeteer has been using this new Headless mode as default since version 22. If you are using Chrome Headless through other automation solutions, you can force the new Headless mode with the --headless=new command-line switch.

While Chrome's new Headless mode is more powerful, it's not as lightweight as the old Headless mode. If you are super resource-constrained or don't need all of Chrome's features, you can use the old Headless mode as chrome-headless-shell.

Chrome for Testing

When you test, you need fine-grained control over your testing environment: the operating system, the browser, and browser version. With Chrome's auto-update this can be difficult.

That's why we created Chrome for Testing—a version of Chrome without auto-update, released alongside every version of Chrome, for every major operating system, accessible from a versioned archive. This lets you run your automation workflows against a specific version of Chrome without much fiddling.

You can access Chrome for Testing binaries from the Chrome for Testing availability dashboard, the JSON API, or with the Puppeteer command-line utility.


Puppeteer, Chrome's updated Headless mode, and Chrome for Testing are only part of the work our team is currently doing to make browser automation and running tests as smooth as possible for you. And related tools, like DevTools Recorder, support you in the creation of tests: record a user flow in Chrome and replay it in Puppeteer.

Learn Testing on web.dev

The tools covered in this post will help you to improve your automated testing. But, if you are just getting started it can seem like a lot to understand and learn. Therefore, we've created a new 10 module course—Learn Testing on web.dev. This in-depth course covers the core concepts of testing, where and how tests are run, test types, and what to actually test. It's a great starting point for your testing journey. Once you have the essentials, feel free to move on to our Test Automation collection with deep dives and practical tips on more specific testing questions.