Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Playwright’s code generator to record a browser journey, then review the generated test before relying on it. To scale, make tests independent, choose projects for the coverage you need, and increase concurrency deliberately: workers run tests within a job, while shards distribute work across CI jobs or machines.

Generate a test by recording a browser journey

Install Playwright in your project first, then run codegen with the page you want to exercise:

npx playwright codegen https://your-site.example

Playwright opens a browser and the Inspector. Perform a representative journey in the browser; the Inspector generates code as you interact. When finished, stop recording and copy the generated test into your project. The URL is optional: running npx playwright codegen opens the browser without navigating to a supplied address. See the Playwright codegen guide.

Review the generated test instead of treating it as finished coverage

Codegen proposes locators, prioritizing role, text, and test-id locators. When a locator matches multiple elements, it attempts to make the locator unique. That does not establish that it targets the right control or that the test verifies the intended outcome. Check the generated locators against the page semantics, add or correct assertions for the behavior that matters, and review setup and expected results. A recorded click sequence alone is not proof that the feature works. See Playwright’s best practices.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Record signed-in flows without leaking authentication state

To record a journey that requires an existing login, you can load saved browser state:

npx playwright codegen --load-storage=auth.json https://your-site.example

The saved state can restore cookies, local storage, and IndexedDB for the recording session. Treat the file as a credential: use it locally, exclude it from version control, and delete it when it is no longer needed. Do not commit a real account’s authenticated state. The codegen documentation describes storage-state recording and use.

Organize browser and environment coverage with projects

A Playwright project is a logical group of tests that shares configuration. Projects let one test suite run with different browser or device settings, against different environments, or as distinct test groups. Use them to make the intended coverage explicit rather than duplicating tests just to vary configuration. See Playwright projects.

Use dependencies for setup that must happen first

Project dependencies allow setup projects to run before the projects that depend on them. This can express prerequisites in the test configuration. Dependent browser projects still consume workers when they run, so plan concurrency for the whole matrix, not just one project. Configuration options are documented in the configuration reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Choose workers or shards based on where you need concurrency

Strategy Where work runs When it fits Key constraint
Workers Multiple worker processes within one Playwright test run A machine or CI job has enough resources and tests are independent More workers consume more CPU and browser memory; workers do not share in-memory state
Shards Separate portions of the suite across machines or CI jobs You want to distribute a larger suite across available CI jobs Requires CI orchestration and results from the separate jobs to be collected appropriately

Playwright runs test files in parallel by default; tests within a file run in order by default. Parallel execution uses separate worker processes, so tests cannot rely on shared in-memory state. Make tests independent and isolate test data and accounts before raising concurrency. The parallelism guide explains workers and sharding.

Set a worker limit for a local run

For example, this command limits the run to four workers:

npx playwright test --workers=4

Four is an example, not universal tuning advice. The useful limit depends on available CPU, browser memory, CI resource limits, and whether tests contend for shared accounts or data. Use fewer workers if resource pressure or test interference makes results unreliable.

Distribute the suite with shards

A shard selects a fraction of the suite for a run. For example, this runs shard two of three:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
npx playwright test --shard=2/3

Run the other shard indices as separate jobs to distribute the suite across machines or CI jobs. The shard command selects work; your CI configuration is responsible for starting the jobs and handling their outputs. Review the sharding guidance alongside your CI provider’s workflow.

Configure CI for stability before maximizing parallelism

Playwright’s CI guide recommends one worker in CI to prioritize stability and reproducibility. That is a stability-oriented starting point, not a rule that fits every machine or suite. If the suite needs wider execution, sharding lets CI distribute work across jobs while keeping each job’s worker count controlled. Available hardware and resource limits matter.

npx playwright test --workers=1

When deciding how to scale, weigh the location of concurrency (workers in a job or shards across jobs), available CPU and browser memory, test-data and account isolation, the browser/device/environment matrix, and the time needed to diagnose failures. See Playwright’s CI guide.

Use retries as diagnostic evidence, not a fix

Retries are disabled by default. If a test fails on its first attempt and passes on retry, Playwright reports it as flaky; if it continues to fail through its retries, it remains failed. A retry can expose intermittency in reports, but it does not correct the underlying cause. Investigate flaky results for timing assumptions, shared state, unstable dependencies, or resource contention instead of treating a retry pass as an uncomplicated success. Retry and trace settings are in the retries guide and configuration reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Useful commands for the workflow

  • npx playwright codegen https://your-site.example — record a journey and generate a test draft.
  • npx playwright test --project=chromium — run the selected project.
  • npx playwright test --workers=4 — cap a run at four workers; tune to the environment.
  • npx playwright test --shard=2/3 — run the second of three shards.

CLI options may change across Playwright versions. Check the documentation matching the version installed in your project; the CLI reference lists current command options.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common recording and scaling problems

Codegen does not open or the command is not found

Run the command from the project where Playwright is installed and use npx playwright so the project’s package version is invoked. If the command still fails, install or initialize Playwright for that project and check the error output for missing browser dependencies.

The generated locator selects the wrong element

Inspect the page for duplicate labels or controls and verify the target’s role, accessible name, text, or test id. Replace an ambiguous locator with one that identifies the intended element, then assert the resulting behavior rather than only the action.

A recorded signed-in flow appears logged out

Confirm codegen was launched with the intended storage-state file and that the state is valid for the target site and account. Cookies and browser storage can expire or differ by origin. Do not solve this by committing a live authentication file.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

More workers make tests fail intermittently

Look for shared accounts, colliding test data, mutable global state, and CPU or memory pressure. Isolate the data each test uses, then raise worker count in measured increments. If one job lacks resources, distribute work through CI shards instead of adding more workers to that job.

Retries make a run look green despite failures

Check the report for tests that passed only after retry and investigate them as flaky. Retries are useful for surfacing intermittent behavior; they are not evidence that the first-run failure has been repaired.

Or skip the browser setup

For a screenshot rather than an interactive test, ScreenshotNeo is a website screenshot API and MCP server. One GET request can return a screenshot or PDF; its API is not a replacement for Playwright test assertions or browser-automation workflows. For a PNG screenshot, save this response as shot.png:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://your-site.example -o shot.png

See the ScreenshotNeo API documentation for request options. Cookie banners and consent notices, newsletter popups, and chat widgets are removed before capture; each of those steps can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses report the page verdict and billing status in headers. Its MCP server offers AI agents tools for screenshots, page information, and PDF capture. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

Frequently Asked Questions

Does Playwright codegen create a complete test automatically?

No. It records interactions and proposes locators; review the assertions, target elements, setup, and expected outcomes before relying on the test.

Should I increase workers or add CI shards first?

Use workers when a job has spare resources and tests are independent. Use shards to distribute the suite across jobs or machines when additional within-job concurrency is not a good fit.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.