What is Playwright? A Guide to Playwright Automation
The official documentation for Playwright reads:
Playwright provides a set of APIs to automate Chromium, Firefox and WebKit browsers. By using the Playwright API, you can write JavaScript, Typescript and other languages to create new browser pages, navigate to URLs and then interact with elements on a page. Our focus in this guide will be on the Javascript & Typescript side of things.
You can import Playwright’s provided test
and expect
functions to declare tests and add assertions. We’ll be using these throughout our e2e examples as a best practice.
Main use cases
- Test automation in modern web applications: verifying that the features we are exposing our users/customers to are actually behaving as expected.
- Cross-browser testing: ensuring applications are working consistently across browsers and rendering engines.
- Taking screenshots of web pages: useful for a variety of different uses going from simple archiving to automated comparison for e.g. visual testing.
- Scraping web sites for data: extracting data from websites for later retrieval or analysis.
- Automating interaction of web pages: speed up and scale any sort of sequence of actions we would like to perform on a website automatically.
In this guide you will find multiple examples showing how to leverage Playwright, with a focus on test automation / active reliability.