Introduction

Performance is one of the key factors that determines the success of a web application. Even if your application is functionally correct, slow page loads or delayed interactions can negatively impact the user experience. While dedicated tools such as Lighthouse, k6, JMeter, and Locust are commonly used for performance and load testing, Playwright can also help you monitor frontend performance metrics during UI automation. In this article, we'll explore how to collect performance metrics using Playwright and build a reusable performanceHelper.ts utility.

Why Measure Performance During UI Tests?

Adding performance checks to your UI automation helps you:

Although Playwright is not a load-testing tool, it is excellent for measuring browser-side performance.

What Can Playwright Measure?

Playwright provides access to the browser's Performance API, allowing you to measure:

Creating a Performance Helper

Instead of duplicating performance logic across tests, create a reusable helper.

Screenshot 2026-07-02 151041

Using the helper

Screenshot 2026-07-02 151403

Sample Output

{
  pageLoadTime: 920,
  domContentLoaded: 610,
  responseTime: 180
}

Login action took 430 ms

Best Practices

Limitations

Conclusion

Playwright is a great tool for checking basic website performance during UI automation. With a simple performanceHelper.ts, you can measure page load time and user actions to find performance issues early. For advanced performance or load testing, use Playwright together with tools like Lighthouse, k6, or JMeter.