Playwright Automation Tool

Profile picture for user arilio666

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.

Why Playwright?

  1. Cross-Browser: All modern rendering browser engines, including chromium, WebKit, and Firefox, are supported in Playwrights, making cross-browser testing flawless.
  2. Cross-Platform: You can test Playwright scripts in Linux, macOS, Windows.
  3. Headless: Playwright supports both Headless and headed mode.
  4. Cross-language: You can use playwright API in multiple programming languages such as TypeScript, JavaScript, Python, .NET, Java.
  5. Mobile Support: The Playwright can also test mobile web apps with native mobile emulation of chrome for Android and Safari.
  6. 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.
  7. 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.
  8. Web-first Assertions: Playwright's assertions are more intelligent in that it retries for the conditions that need to be satisfied automatically.
  9. 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.
  10. Events: Playwright allows listening to different events on the web page, including network requests, creation of child pages, dedicated workers, etc.
  11. Frame Testing And Pierce Shadow DOM: The selectors from the Playwright can pierce shadow DOM and enter frames seamlessly.
  12. 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.
  13. 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.
  14. 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.
  15. Inspector: It can inspect page. Generate selectors explore execution logs.
  16. 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. 
  17. Test Retry Strategy: You can configure the test retry strategy with Playwright. 
  18. Accuracy and High Speed: Playwright is faster and more accurate.
  19. CI/CD Tools & Docker Support: CI/CD servers such as Jenkins, CircleCI, Azure Pipeline, TravisCI, etc
  20. Testing Framework: Support for Testing frameworks like Jest, Jasmine, Mocha and AVA.
  21. 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.