Set up Playwright with Perfecto – Desktop web

To integrate Playwright with Perfecto for desktop web testing, choose your preferred programming language and follow the steps below. You can implement Playwright tests in Java, JavaScript, or TypeScript.

For information on supported operating systems and browsers as well as prerequisites, see Playwright.

This document includes references to a third-party product, Playwright. The user interface and usage of third-party products are subject to change without notice. For the latest published information about Playwright, see the Playwright documentation.

Setup steps

Perfecto supports Playwright for desktop web testing on Windows using Chrome and Microsoft Edge. Follow the steps for your chosen language.

Click a language to expand the steps.

Optional configuration

The following options let you adjust how Playwright runs desktop web tests in Perfecto beyond the basic setup.

Headless mode

Headless mode lets you run Playwright desktop web tests without a visible UI. This is useful for automated and CI-driven test runs where interactive monitoring is not required.

When headless mode is enabled, Perfecto does not provide live streaming or video recordings in the test report.

Enable headless mode

To run Playwright desktop web tests in headless mode, add the following capability to your Playwright capabilities:

Copy
capabilities.addProperty("perfecto:headless", "true");

Browser startup arguments

You can pass custom browser startup arguments when running Playwright desktop web tests with Perfecto by using the playwrightArgs capability.

Because Perfecto launches the browser remotely before your Playwright client connects, Playwright's local launch() options are not applied. Use this capability to control browser startup behavior for the remote browser process.

Copy
JsonArray playwrightArgs = new JsonArray();
playwrightArgs.add("--force-dark-mode");
capabilities.add("PlaywrightArgs", playwrightArgs);

The following limitations apply when using this capability:

  • The playwrightArgs capability applies only to desktop web remote browser sessions.

  • Use this capability when your test connects to a remotely started browser instance by using connect(wsUrl).

What's next

Integrate Playwright with Perfecto Smart Reporting