What is Playwright? Advantages of Playwright?

Testers Talk
3 min readAug 8, 2024

--

Let’s start understanding what is playwright? Playwright is an open-source automation library for browser testing and web scraping developed by Microsoft and launched on 31 January 2020, which has since become popular among programmers and web developers.

Playwright provides the ability to automate browser tasks in Chrome, Chromium, Edge, Firefox and WebKit with a single API.

what is playwright? playwright advantages

-> What are the Advantages using Playwright Tool?

1. Any browser • Any platform

Cross-browser. Playwright supports all modern rendering engines including Chromium, WebKit, and Firefox.

Cross-platform. Test on Windows, Linux, and macOS, locally or on CI, headless or headed.

Cross-language. Use the Playwright API in TypeScript, JavaScript, Python, .NET, Java.

Test Mobile Web. Native mobile emulation of Google Chrome for Android and Mobile Safari. The same rendering engine works on your Desktop and in the Cloud.

2. Resilient • No flaky tests

Auto-wait. Playwright waits for elements to be actionable prior to performing actions. It also has a rich set of introspection events. The combination of the two eliminates the need for artificial timeouts — the primary cause of flaky tests.

Web-first assertions. Playwright assertions are created specifically for the dynamic web. Checks are automatically retried until the necessary conditions are met.

Tracing. Configure test retry strategy, capture execution trace, videos, screenshots to eliminate flakes.

3. No trade-offs • No limits

Multiple everything. Test scenarios that span multiple tabs, multiple origins and multiple users. Create scenarios with different contexts for different users and run them against your server, all in one test.

Trusted events. Hover elements, interact with dynamic controls, produce trusted events. Playwright uses real browser input pipeline indistinguishable from the real user.

Test frames, pierce Shadow DOM. Playwright selectors pierce shadow DOM and allow entering frames seamlessly.

4. Full isolation • Fast execution

Browser contexts. Playwright creates a browser context for each test. Browser context is equivalent to a brand new browser profile. This delivers full test isolation with zero overhead. Creating a new browser context only takes a handful of milliseconds.

Log in once. Save the authentication state of the context and reuse it in all the tests. This bypasses repetitive log-in operations in each test, yet delivers full isolation of independent tests.

5. Powerful Tooling

Codegen. Generate tests by recording your actions. Save them into any language.

Playwright inspector. Inspect page, generate selectors, step through the test execution, see click points, explore execution logs.

Trace Viewer. Capture all the information to investigate the test failure. Playwright trace contains test execution screencast, live DOM snapshots, action explorer, test source, and many more.

Reference: https://playwright.dev/docs

===== Playwright Automation Full Courses =====

-> Playwright Automation Full Course

> Playwright API Testing Crash Course

-> Playwright with Azure DeveOps Pipeline

-> Playwright with CRM Application Testing

===== Playwright GitHub Repositories =====

-> Playwright Automation Full Course https://github.com/BakkappaN/PlaywrightTutorialFullCourse

-> Playwright API Testing Crash Course https://github.com/BakkappaN/PlaywrightAPITestingTutorial

-> Playwright with Azure DevOps Pipeline https://github.com/BakkappaN/PlaywrightAzureDevopsPipeline

-> Playwright with CRM Application Testing https://github.com/BakkappaN/MicrosoftD365CRMPlaywrightFramework

-> Playwright with JavaScript Framework [UI + API] https://github.com/BakkappaN/PlaywrightBaseAutomationFramework

-> Playwright with TypeScript Framework [UI + API] https://github.com/BakkappaN/Playwright-TypeScript-Framework

#playwright #apitesting #qa #softwaretesting #crm #javascript #typescript #ado #azuredeveops #framework #fullcourse #codegen #test #e2e #testing #automation #testerstalk #bakkappan #git #github

Connect with me on LinkedIn: www.linkedin.com/in/bakkappa-n

Join to LinkedIn group: https://www.linkedin.com/groups/10393547/

Subscribe my channel to get daily updates: https://www.youtube.com/@testerstalk?sub_confirmation=1

--

--

Testers Talk

Learn Everyday: Software Testing, Playwright, Cypress, Selenium, Postman, Rest Assured, API Testing, Test Automation, Framework, QA, SDET, Test Automation.