Playwright: Modern Browser Automation for Testing and Scraping cover

Web · Ebook

Playwright: Modern Browser Automation for Testing and Scraping

by Shriira Press

4.8(4,929)89 pagesPublished 2026

A comprehensive, self-contained guide to Playwright — the modern framework (from Microsoft) for driving real browsers through code. Like Selenium, it launches Chromium, Firefox, and WebKit, navigates pages, runs their JavaScript, clicks and types, and reads the rendered result — for two big jobs: automated end-to-end testing and scraping JavaScript-rendered pages. But Playwright was designed after Selenium, learning from its pain points: it auto-waits for elements (eliminating most flaky-test bugs), drives all major engines through one API, intercepts and mocks network traffic, and ships a first-class test runner, codegen, and trace viewer. This book teaches it end to end — the browser/context/page model, locators, actions and auto-waiting, web-first assertions, network interception, real-world page handling, scraping, the test runner, and debugging/CI — blending intuition, the concepts behind the framework, and runnable code.

Contents

  1. 1Preface
  2. 2Chapter 1 — What Is Playwright?
  3. 3Chapter 2 — How Playwright Works: Browser, Context, and Page
  4. 4Chapter 3 — Getting Started: Installation and Your First Script
  5. 5Chapter 4 — Locators: Finding Elements the Playwright Way
  6. 6Chapter 5 — Actions and Auto-Waiting
  7. 7Chapter 6 — Assertions and Web-First Waiting
  8. 8Chapter 7 — Navigation, Network, and Waiting for State
  9. 9Chapter 8 — Network Interception and Mocking
  10. 10Chapter 9 — Real-World Pages: Frames, Dialogs, Auth, and Downloads
  11. 11Chapter 10 — Scraping with Playwright
  12. 12Chapter 11 — The Playwright Test Runner
  13. 13Chapter 12 — Debugging, Tracing, and CI
  14. 14Chapter 13 — In Practice, the Ecosystem, and the Profession
  15. 15Appendix A — Glossary and Quick Reference
  16. 16Appendix B — Further Reading and Resources