So, what is Playwright?
Playwright is a Node.js library created by Microsoft to automate Chromium, Firefox, and WebKit with a single API. Playwright is built to enable cross-browser web automation that is ever-green, capable, reliable, and fast across all modern browsers.
It is open source and free.
Some of the team members of Playwright were previously working at Google on another tool you might have heard of called Puppeteer.
Playwright has powerful automation capabilities since it has full API coverage for all modern browsers.
With Playwright, you can even test how your app behaves in Apple Safari with WebKit builds for Windows, Linux and macOS. And you can do it locally or on CI!
You can use device emulation to test your responsive web apps in mobile web browsers.
Also, Playwright supports headless and headful modes for all browsers and all platforms. Headful is great for debugging, and headless is faster and suited for CI/cloud executions.
Playright has a fast and reliable execution like:
Auto-wait APIs which means that the Playwright interactions auto-wait for elements to be ready. This improves reliability and simplifies test authoring.
Playwright has timeout-free automation which means that Playwright receives browser signals, like network requests, page navigations and page load events, to eliminate the need for sleep timeouts that usually cause flakiness.
Playwright can rely on user-facing strings, like text content and accessibility labels to select elements which makes these selectors more resilient.
Yes, I know that all of this sounds pretty cool, but Playwright also has limitations for example:
Quiz
The quiz for this chapter can be found in 1.2