The Playwright is an automation tool from Microsoft for reliable end-to-end testing for modern web apps. The Playwright is a perfect rival against Selenium.
The top two contributors of Playwright are the same ones who created the Puppeteer; Puppeteer is an open-source node-js-based framework built by Google.
- Cross-Browser: All modern rendering browser engines, including chromium, WebKit, and Firefox, are supported in Playwrights, making cross-browser testing flawless.
- Cross-Platform: You can test Playwright scripts in Linux, macOS, Windows.
- Headless: Playwright supports both Headless and headed mode.
- Mobile Support: The Playwright can also test mobile web apps with native mobile emulation of chrome for Android and Safari.
- Auto Wait: Playwright auto waits for elements to be actionable before performing actions. The Playwright carries out inspections to determine if a selector may accept events and if they are stable, visible, or linked to DOM. With the combination of auto waits and introspection, there is no need to use explicit timeouts.
- Custom Waits: The Playwright offers customized waiting by overriding default behavior of wait for scenarios like slow page loading, where tests may wait until a selection is ready. Likewise, some network circumstances can be waited for using custom waits.
- Web-first Assertions: Playwright's assertions are more intelligent in that it retries for the conditions that need to be satisfied automatically.
- Multiple Users: Sometimes, you have more than one signed-in user in your end-to-end tests. You can achieve that via logging in for these users multiple times in a global setup configuration and saving that state into different files.
- Events: Playwright allows listening to different events on the web page, including network requests, creation of child pages, dedicated workers, etc.
- Frame Testing And Pierce Shadow DOM: The selectors from the Playwright can pierce shadow DOM and enter frames seamlessly.
- Browser Contexts: Using Browser Context you can run test in an isolated session in an incognito similar to a browser. Browser contexts can be also used to emulate multi-page scenarios involving mobile devices, permissions, locale and color scheme.
- Parallelism and sharding: Playwright runs tests in parallel. In order to achieve parallelism, it runs several worker processes together. Playwright Test can shard a test suite, so that it can be executed on multiple machines.
- One Time Login: Playwright enables the login of cookies inside a context once and retains the session data. This can restrict repetitive login operations of each test.
- Inspector: It can inspect page. Generate selectors explore execution logs.
- Trace Viewer: The Playwright captures all the information to investigate the test failure. The trace contains test execution screencast, live DOM screenshots, test source, videos, etc.
- Test Retry Strategy: You can configure the test retry strategy with Playwright.
- Accuracy and High Speed: Playwright is faster and more accurate.
- CI/CD Tools & Docker Support: CI/CD servers such as Jenkins, CircleCI, Azure Pipeline, TravisCI, etc
- Testing Framework: Support for Testing frameworks like Jest, Jasmine, Mocha and AVA.
- Other Features: API Testing, Page Object Model, Multiple Tabs Support, Multiple Origin Support, CodeGen, Annotation, Parametrize test, Built in and Custom Reporters, Visual Comparison, Support for Selenium Grid, migration of scripts from other tools like protractor.