Power Your Software Testing with AI Agents and Cloud
The Native AI-Agentic Cloud Platform to Supercharge Quality Engineering. Test Intelligently and Ship Faster.
- TestMu AI (Formerly LambdaTest)
- /
- Learning Hub
- /
- Playwright Tutorial: Futuristic Features
Playwright Tutorial: Futuristic Features
Playwright futuristic features explained: test generator and inspector, fixtures, reporters, failure screenshots and videos, retries, and auto-waiting.
Last Updated on:
Playwright is an open-source automation testing framework by Microsoft for web testing. Playwright features help you test across all modern browsers in a reliable, effective and fast manner. Be it codeless or code-based, Playwright features help you test anything from unit testing to automation end-to-end testing It is becoming increasingly popular amongst many developers. For instance a survey conducted by StateofJS, showcases that Playwright has gained an increase in awareness from 19% to 34% amongst many developers.

In our previous Playwright tutorial series, we discussed the basics of Playwright, outlining its capabilities and how to install Playwright using the VS Code plugin. Let’s discuss Playwright features in this tutorial.
Overview
To automate modern web testing efficiently, use the open-source Playwright framework for fast cross-browser execution, and scale your test suites on the TestMu AI cloud platform. Playwright provides reliable end-to-end browser automation, while TestMu AI executes these tests across 3,000+ browser/OS combinations.
Why Is Playwright a Popular Choice for Web Testing?
Playwright is an open-source testing framework by Microsoft that enables fast, reliable cross-browser automation, supporting everything from component testing to full end-to-end web application testing.
What Are the Most Prominent Playwright Features?
- Playwright Test Generator and Test Inspector: Automatically records user interactions to generate test scripts and provides an inspector to step through tests, analyze selectors, and debug failures.
- Playwright Fixtures: Manages test setup and teardown automatically to establish consistent environments, share resources, and create cleaner test architecture across projects.
- Screenshots and Videos on Test Failures: Captures visual media during Playwright test failures to help teams understand issues and accelerate troubleshooting without rerunning scenarios.
- Playwright Retries: Uses built-in retry logic to automatically rerun failed tests, which reduces false failures and improves overall confidence in continuous integration pipelines.
- Playwright Auto-Waiting Mechanism: Ensures elements are ready before actions execute, eliminating artificial timeouts, minimizing timing issues, and reducing flaky tests.
How Can You Scale Playwright Testing with the TestMu AI Cloud?
- Seamless CI/CD Integration: Connects Playwright tests with CI/CD tools on TestMu AI to trigger automated test execution during every build, deployment, and release cycle.
- Advanced Debugging Capabilities: Allows teams to analyze Playwright failures on TestMu AI using network logs, command logs, and video recordings to identify issues quickly.
- HyperExecute Orchestration: Runs Playwright tests on TestMu AI up to 70% faster than other testing clouds, shortening feedback loops for quicker releases.
- Parallel Testing Support: Runs Playwright tests across multiple browser and operating system configurations simultaneously on TestMu AI to reduce overall execution time.
- Custom Test Analytics: Provides personalized dashboards and widgets on TestMu AI to track automation performance, visualize trends, and make data-driven testing decisions.
- Multi-Framework Support: Executes tests for Selenium, Cypress, Puppeteer, and mobile frameworks like Appium, Espresso, and XCUITest on a single TestMu AI cloud platform.
What Are the Most Prominent Playwright Features for Automation Testing?
The most prominent Playwright features are the test generator and inspector, fixtures, built-in reporters, screenshots and videos on failure, retries, and auto-waiting.
As per StateofJS survey, Playwright was able to consistently retain 100% of its users from 2020 to 2021. No wonder, Playwright has been the talk of the town in the testing community as one of the best options to consider automation testing. What makes Playwright special? Let's have a look at some of the most notable Playwright features for test automation.
- Playwright Test Generator and Test Inspector
- Playwright Fixtures
- Screenshots And Videos On Test Failures
- Playwright Retries
- Playwright Auto-Waiting Mechanism
You can also go through the following video from the TestMu AI YouTube channel to learn more about futuristic Playwright features.
Let’s look at the above Playwright features one by one!
How Do the Playwright Test Generator and Inspector Work?
The Playwright test generator, run with npx playwright codegen, records your browser actions as test code, while the Playwright Inspector steps through tests and helps pick locators.
Playwright comes with the ability to generate tests out of the box and is a great way to quickly get started with testing. It will open two windows, a browser window where you interact with the website to test. The Playwright Inspector window records your tests, copy the tests, clear your tests as well as change the language of your tests.This enables us to easily create tests by recording our actions. Also known as Playwright Test Script Recorder.
In the previous tutorial, we read about a test script showcasing the browser followed by context and page, which eventually led us to a particular site. Since we considered the TestMu AI eCommerce Playground (a demo account), it will get redirected to its home page.
We also learned about the exact use of new context and new pages. The next step was login.
This time, we will use a Playwright feature instead of writing code. To use this feature, we need to follow a few steps:
- Open up the terminal with the help of - Ctrl + J. Type this command:
- Now, you can see a browser page and the Playwright Inspector.
- Login to your TestMu AI eCommerce Playground account.
- Go to Edit your account information (make necessary changes) and press Continue.
- Click on the Logout option.
- Now check the code on the Playwright Inspector.
npx playwright codegen
This command is used for recording tests or generating test scripts.


Eventually, the Playwright Inspector records whatever actions that occur on the browser. (By default, it will be in record mode)
For example, copy the URL of a particular site and paste it into the browser (which is in incognito mode). Now when you look at the Inspector page, you get the exact URL you searched for in the browser.
One of the major highlights around Playwright is its Language Compatibility. Playwright tests by default are generated in JavaScript. However, you can change the Playwright test to other programming languages such as Java, .NET or C#, Python.
A small example of how the Playwright Inspector works is when you make a few changes:
Test Scenario:

Playwright Inspector
Playwright inspector is a great tool that helps in authoring and debugging Playwright scripts. This is a default recommended tool for script troubleshooting. It opens up a browser window highlighting the selectors as you step through each line of the test. You can also use the explore button to find other available selectors which you can then copy into your test file and rerun your tests to see if it passes.
test("Login test demo", async () => {const browser = await chromium.connect("wss://cdp.lambdatest.com/playwright?capabilities=
${encodeURIComponent(JSON.stringify(capabilities))}");
const context = await browser.newContext();
const page = await context.newPage();
await page.goto("https://ecommerce-playground.lambdatest.io/")
await page.hover("//a[@data-toggle='dropdown']//span[contains(.,'My account')]")
// await page.click("text=Login")
await page.click("'Login'")
await page.fill("input[name='email']", "koushik350@gmail.com")
await page.fill("input[name='password']", "Pass123$")
await page.click("input[value='Login']");
await page.close();
await context.close();
await browser.close(); What Are Playwright Fixtures?
Playwright fixtures set up an isolated environment for each test, such as a fresh page or browser context, and tear it down afterward, so tests stay independent.
Playwright test comes from the concept of test fixtures. Fixtures establish an environment for each test. After we complete the steps under Playwright test script recording, we need to;-
Test Scenario:
- Create a new test file in the VS Code with the name “recorded.test.ts’’ and save it.
- Close the codegen browser as well as the Playwright Inspector.
- The difference that the Playwright test runner creates is that - we don’t need to launch a Chromium browser; instead, we place a code that indicates ‘’page. goto along with the URL.’’ In short, we can say that there is the usage of only parameters under the Playwright test runner, and this concept is known as the Playwright fixtures.
- To execute this, go to the file named “playwright.config.ts’’; you will see a code that says testMatch (specify the folder, followed by file name).
- Enter your new test file - testMatch: [tests/recorded.test.ts”]
- Next, bring up the terminal with - Ctrl + J, and type npx playwright test.
- Playwright, by default, runs in the headless mode. Hence when we execute a test, we cannot see the graphical user interface/taskbar. We will use a new method to fix this issue.
- Go to the configuration file and add code for the headless mode. Eventually, the code will look like this -

Also, this configuration test applies to all the tests we perform.
What Reporters Does Playwright Provide?
Playwright ships built-in reporters including list, line, dot, HTML, JSON, and JUnit, and you can combine several or write a custom reporter.
In-built reporters is another Playwright feature for different needs to provide custom reporters. There are a wide variety of reporters. You can also use multiple reporters at the same time. The reporter command-line option is the simplest way to try out built-in reporters.
Examples of a few reporters are - DOT, LINE, GitHub, JSON, JUnit, and HTML. We will focus more on DOT, HTML, and JSON.
Test Scenario:
- Go to the ‘’playwright.config.ts’’ file once we add the reporter code, and it will look like this.
{testmatch: [‘’tests/recorded.test.ts’’], use: {headless: false}, reporter: [ [‘’dot’’], [‘’json’’, {output file: ‘’jsonReports/jsonReport.json’’}], [‘’html’’, {open: ‘’never’’}]]

You will be able to see the multiple steps in the test. Example ‘’navigating to a particular site, hover action, login, accession’’.
Also, if you are familiar with Selenium Cucumber, you might know about hooks (before and after hooks).
The function of hooks - ‘before hooks’ runs before the test begins, and ‘after hooks’ runs after the test ends.

How Do You Capture Screenshots and Videos on Playwright Test Failures?
Set screenshot to only-on-failure and video to retain-on-failure in playwright.config, and Playwright keeps screenshots and videos only for the tests that fail.
Screenshots/Videos can benefit a testing server when a test fails. It can show what exists on the screen when a test fails. This Playwright feature is beneficial when we want to know where we could have gone wrong at one glance.
Suppose you want to view a screenshot or video of a particular test. You will have to add two additions to your script - screenshots and video.

After your test ends, you can view screenshots and videos.
Screenshot:

Video:

You will get three options when you add a “screenshot” in the script.
- Off
- On (captures screenshot when chosen)
- Only-on-failure (if there’s a failure in the test, the Playwright will capture a screenshot)
Next, we need to add “video” in the script, which will also show a few options.
- Off
- On
- On-first-entry
- Retain-on-failure
- Reentry-with-video
We need to understand that taking screenshots or videos of multiple tests may increase reporters' size. Hence we can choose a particular part of the test rather than the entire process. To enable this feature, select “retain-on-failure” in the test script.

Under this feature, we capture a screenshot only when there’s a failure in the test.
How Do Playwright Retries Work?
Playwright retries rerun a failed test up to the count set in the retries option, and a test that passes on a retry is reported as flaky rather than passed.
If you want to retry any particular test, you can add “retries'' to the script. Playwright retries are reliable as we can acquire screenshots and videos regardless of how many times you repeat a test. We can use it to run a test multiple times.
The image below shows the code we enter to enable the Playwright Retry option. To view a failed test, we have the option to enter the maximum number of retries we would want.

After the test ends, we can view the failed script we chose to retry.

This Playwright feature is beneficial when a test fails, as you can retry and figure out where you went wrong. Hence, with multiple retries, we can avoid the failure of a test.
How Does Playwright's Auto-Waiting Work?
Before each action, Playwright auto-waits until the element is attached, visible, stable, enabled, and able to receive events, so tests rarely need manual sleeps.
The auto-wait mechanism is a process that might seem lengthy but easy if you are familiar with JavaScript. There are a few conditions under which Playwright's actions will depend. The conditions are as follows:
- Attached
- Visible
- Stable
- Receives Events
- Enabled
Every action ensures they pass through these conditions or elements. It waits for all relevant checks to pass before performing the requested action. The combination of conditions and actions eliminates the need for artificial timeouts. Hence the auto-wait mechanism helps reduce flaky tests.
If you are a developer or a tester looking to validate your Playwright test automation skills, you can go for Playwright 101 certification from TestMu AI.
TestMu AI is a test execution and test orchestration platform on cloud with an automation testing grid of 3000+ browsers and operating systems to help you scale your Playwright test execution effortlessly. TestMu AI lets you:
- Integrate seamlessly with your CI/CD pipelines.
- Debug Playwright tests from a variety of logs such as network logs, command logs, and full video recordings.
- Execute Playwright tests 70% faster than any testing cloud by leveraging HyperExecute, the fastest end-to-end test orchestration cloud by TestMu AI.
- Run Playwright tests in parallel on multiple configurations and trim down your test execution by multiple folds.
- Organise your test analytics by creating custom dashboards and widgets.
TestMu AI’s automation testing cloud also supports Selenium, Cypress, Puppeteer, and even app automation frameworks such as Appium, Espresso, XCUITest etc.
How Are AI Agents Extending Playwright's Features?
AI agents now build on Playwright's features: they plan tests, generate them, and repair failures, and they can drive a real browser through Playwright on an assistant's behalf.
Playwright's own test agents extend codegen into three roles: a planner that explores the app and produces a Markdown test plan, a generator that turns the plan into test files, and a healer that repairs failing tests.
Playwright MCP exposes the browser to AI assistants through the Model Context Protocol, passing structured page snapshots instead of screenshots so a model can click, type, and assert. See this guide on AI and Playwright MCP for setup.
The older features still matter here: traces, screenshots, and retries are how you check what an agent did before trusting a healed test.
Which Playwright Features Should You Adopt First?
Adopt the test generator and auto-waiting first, add failure screenshots, videos, and traces for debugging, then enable retries in CI mainly to label flaky tests.
Playwright makes automation quick, reliable, and simple. In this tutorial, we discussed the prominent features of Playwright such as test generator, generating screenshots and videos on test failures, retries, fixtures and auto-wait mechanism. In the upcoming tutorial, we will deep dive into understanding handling of inputs and buttons.
If you want to go beyond scripted automation run through the command line, look at a Playwright CLI alternative and explore Playwright Agents, which use AI to autonomously plan, generate, and execute Playwright tests.
Here’s a glimpse of how you can perform Playwright browser testing on the TestMu AI cloud grid.
Subscribe to the TestMu AI YouTube Channel and stay updated with the latest Playwright topics.
Author
Mythili is a Community Contributor at TestMu AI with 3+ years of experience in software testing and marketing. She holds certifications in Automation Testing, KaneAI, Selenium, Appium, Playwright, and Cypress. At TestMu AI, she leads go-to-market (GTM) strategies, collaborates on feature launches, and creates SEO optimized content that bridges technical depth with business relevance. A graduate of St. Joseph’s University, Bangalore, Mythili has authored 35+ blogs and learning hubs on AI-driven test automation and quality engineering. Her work focuses on making complex QA topics accessible while aligning content strategy with product and business goals.
Reviewer
Parth Mistry is a Member of Technical Staff at TestMu AI (formerly LambdaTest), building SmartUI, the visual regression testing product. He developed and owns the SmartUI CLI, a modular TypeScript tool built on Playwright for multi-browser automation, and built the Storybook CLI for visual regression of UI components. He maintains cross-language SDKs in Python, Java, Ruby, C#, and Node.js, and engineered a Node-based visual rendering service on Kafka, Redis, MySQL, and S3. His migration of that service to an event-driven, KEDA-autoscaled architecture improved execution speed by 60% and cut annual infrastructure cost by $9,600. He also built the end-to-end SmartUI integration with KaneAI. Parth is a Google Summer of Code 2024 contributor and an alumnus of IIT Jodhpur.
On This Page
- What Are the Most Prominent Playwright Features for Automation Testing?
- How Do the Playwright Test Generator and Inspector Work?
- What Are Playwright Fixtures?
- What Reporters Does Playwright Provide?
- How Do You Capture Screenshots and Videos on Playwright Test Failures?
- How Do Playwright Retries Work?
- How Does Playwright's Auto-Waiting Work?
- How Are AI Agents Extending Playwright's Features?
- Which Playwright Features Should You Adopt First?
Playwright Features FAQs
Did you find this page helpful?
More Related Learning Hubs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance
- Advanced access controls
- Advanced data retention rules
- Advanced Local Testing
- Premium Support options
- Early access to beta features
- Private Slack Channel
- Unlimited Manual Accessibility DevTools Tests






