Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Playwright Codegen can turn a browser journey into a first draft of a test, but recording alone does not make a suite scalable. Use it to discover interactions and locators, then review the test’s intent, isolate its data and authentication, broaden coverage with projects, and increase CI parallelism only as your tests and infrastructure allow. This guide moves from a first recording to a maintainable multi-browser and multi-machine workflow.
What Playwright Codegen does—and what it does not
Playwright’s test generator opens a browser alongside Playwright Inspector, records interactions, and produces test code. You can stop recording, inspect or pick locators, and copy the generated code into your project. Codegen favors role, text, and test ID locators; when a locator matches multiple elements, it can refine the locator to identify the target uniquely.
That makes Codegen useful for quickly drafting a user journey and discovering how the page can be targeted. It does not decide whether the journey is a meaningful test, whether its assertions prove the desired behavior, or whether the test will remain stable as the interface changes. Treat generated code as an editable starting point. Playwright’s best-practices guidance recommends testing user-visible behavior and keeping tests isolated so they can run independently.
How do I generate a Playwright test?
Start a focused recording
With Playwright Test installed in a project, run the generator against the page you want to exercise:
#1 Best Overall
npx playwright codegen https://your-app.example
Replace the example address with the application URL available to your machine. Codegen launches a browser and Inspector. Use the page as a user would, concentrating on one outcome—for example, signing in and reaching a dashboard, or submitting a search and seeing results—instead of recording an entire application as one test.
When you have captured the journey, stop recording and inspect the generated test. Use the locator picker to examine likely targets before copying code. Prefer a locator that expresses a user-facing role or label where that makes the test clearer; use text or an explicit test ID when those fit the interface and remain unambiguous. A locator that happens to be unique today is not necessarily a good expression of the user action.
Review the test before relying on it
For each recorded action, ask whether the locator identifies the intended control and whether the test checks the outcome that matters. A sequence of clicks without an assertion may replay successfully while failing to detect a broken feature. Add or refine assertions around visible results, error messages, or navigation that define the expected behavior.
Free tools Windows power users keep installed
One-click scans. No signup required.
Also remove accidental steps: incidental navigation, exploratory clicks, or waits that merely made the recording work once. A focused test should state one scenario clearly, have deliberate setup, and be understandable when it fails. The generator’s locator improvements help with uniqueness; they are not a substitute for reviewing locator meaning and test intent.
How do I reuse login state safely?
For recording against a page that requires a login, Codegen can save browser state and restore it for a later recording:
Rank #2
npx playwright codegen --save-storage=auth.json https://your-app.example
npx playwright codegen --load-storage=auth.json https://your-app.example
The first command saves cookies, local storage, and IndexedDB state after you authenticate in the opened browser. The second loads that state for the new recording. See the Codegen guide for the generator’s options and the authentication guide for test-run authentication patterns.
Saved state is sensitive. Playwright warns it may include cookies or headers that could let someone impersonate the account. Keep it out of source control and restrict access as you would for credentials. Do not put a real user’s state in a repository simply because it is a convenient way to make a test pass.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Choose account sharing based on what tests change
Shared authentication state can be appropriate when tests use the same account without conflicting changes to server-side data. If tests mutate shared state—such as changing settings, creating records, or consuming one-time data—parallel runs can interfere with one another. Playwright’s authentication guidance recommends separate accounts per parallel worker when tests modify shared server-side state. Account isolation is a data-design decision, not something a storage file can solve.
How do projects broaden coverage?
Projects group tests under shared configuration. They can represent browser choices, device configurations, environments, or other configurations such as logged-in and logged-out cases. This lets a suite run a relevant test set under several configurations without treating each recording as a separate manual workflow.
Use projects when you want the same test intent exercised under meaningfully different conditions. Keep the matrix purposeful: each additional browser, device, or environment increases execution work, and redundant configurations add cost without necessarily finding new defects. Playwright also supports setup dependencies so a setup project can prepare state before projects that depend on it. Define that setup deliberately and ensure dependent tests still have the isolation their data requires.
Rank #3
How do I run Playwright tests in parallel?
Playwright’s documentation states, “Playwright Test runs tests in parallel.” By default, test files run in parallel, while tests within an individual file run in order unless parallel execution is configured. See Parallelism for the current behavior and configuration.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteParallel workers can reduce elapsed time, but they also increase simultaneous browser activity and contention for application resources, test accounts, and shared data. Before increasing workers, make sure tests are independent: one test should not depend on another test’s cookies, storage, created records, or execution order. Playwright identifies isolation as important for reproducibility, debugging, and avoiding cascading failures.
Begin CI with stability, then measure
Playwright’s Continuous Integration guide recommends setting workers to one in CI environments to prioritize stability and reproducibility. This is a recommendation and a conservative starting point, not a universal optimum or a measured promise about runtime. Once the suite is reliable, increase concurrency on capable self-hosted systems based on observed capacity and failure behavior.
There is no universal worker count that suits every application, test suite, and CI machine. More workers may shorten a run when work is independent and resources are available; they may instead make failures more frequent if tests contend for accounts, the application is overloaded, or browsers compete for memory and CPU. Change concurrency deliberately and diagnose whether added parallelism improves the workflow you actually need.
How do I split tests across CI machines?
When one machine is not the right place to run all independent work, Playwright supports sharding. A command such as the following selects one shard from a multi-job run:
Recommended Free Tools
Rank #4
npx playwright test --shard=1/4
Use a different shard index in each CI job, keeping the total shard count consistent across those jobs. The example illustrates the CLI shape; it is not a recommended count or a performance benchmark. The sharding guide explains the supported approach.
Sharding distributes runnable work across machines, but it does not make dependent tests independent. Only work that can run in parallel can be sharded safely. By default, the balancing unit is whole files; with fullyParallel enabled, individual tests can be the balancing unit. File-level distribution is a natural fit when files are already reasonably balanced. Individual-test distribution can make work more granular, but it makes independent-test design especially important.
Projects and shards solve different problems: projects expand the configurations under which tests run, while shards distribute runnable work among CI jobs. Combining them can widen coverage and distribute execution, but plan for the resulting job matrix and ensure authentication, test data, and setup dependencies behave correctly in each job.
How do I make failures diagnosable?
A scalable suite needs useful evidence when a test fails, not just more workers. Playwright recommends using traces to debug CI failures. Its best-practices page describes traces as providing a timeline, DOM snapshots, and network requests. That context can help distinguish a locator problem from an application response, navigation issue, or unexpected page state.
Trace collection has a trade-off: recording every test is performance-heavy. The documented configuration runs traces on the first retry of a failed test, but that is a configuration pattern, not a universal default for every project. Check your current project configuration rather than assuming every Playwright run uses it. Choose an artifact policy that provides enough information to investigate failures without collecting unnecessary data on every successful test.
Best Value
A practical progression from recording to scale
- Record one outcome. Run Codegen against the relevant URL and keep the journey centered on a single user-visible goal.
- Inspect and refine. Review the generated locators, remove incidental actions, and ensure the test asserts the behavior it is meant to protect.
- Make setup independent. Decide how each test gets its data and authentication; avoid relying on a prior test or shared mutable account.
- Introduce projects deliberately. Add browser, device, or environment configurations that represent coverage you need, using setup dependencies where appropriate.
- Establish stable CI execution. Begin with the CI guide’s one-worker recommendation, then evaluate higher concurrency against your own suite and machines.
- Shard independent work. Distribute the suite across CI jobs only after tests can run independently, selecting file-level or individual-test balancing as appropriate.
- Capture actionable failure evidence. Configure traces or other artifacts to make failures diagnosable while accounting for collection overhead.
Common problems and fixes
- The generated test passes once but is brittle. Revisit the locator and the scenario. Prefer a locator that identifies the intended user-facing control, and remove accidental actions or timing assumptions. Add an assertion for the actual outcome.
- A test fails only when run with other tests. Look for shared cookies, storage, accounts, records, or order dependencies. Isolate the data; for parallel tests that modify shared server-side state, use separate accounts per worker as the authentication guidance recommends.
- Parallel CI runs become less stable. Reduce concurrency to a stable baseline, then check for application or machine resource contention and shared state before increasing workers again. One worker is the CI guide’s stability-oriented recommendation.
- A saved login stops working or appears in a repository. Treat storage as credential material, remove it from tracked files, and create or refresh state through a controlled process. State can expire or become invalid; it is not a permanent substitute for test authentication setup.
- Shard jobs do uneven or conflicting work. Confirm that all jobs use the same shard total and distinct shard indexes. Check whether your suite’s work is balanced by file or whether individual-test granularity with
fullyParallelis suitable. Sharding cannot safely compensate for dependent tests. - A CI failure lacks enough context. Review the project’s trace configuration and capture traces for the failure/retry path you need to investigate. Do not assume a particular retry or trace setting is active without checking the project configuration.
Or skip the browser setup
Playwright remains the right tool for browser interaction tests and broad automation. If the narrower task is capturing a page as an image or PDF, ScreenshotNeo offers a screenshot API and MCP server; it is not a replacement for an end-to-end test suite. A single GET request can return a screenshot. For example, using the Stripe URL shown in the API example:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options. Its clean-capture steps can accept cookie or consent banners and remove 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and responses identify page verdict and billing status in headers. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000. Sign up for 1,000 free screenshots a month, with no card required.
Frequently asked questions
Does Codegen replace writing tests by hand?
No. It drafts code from recorded interactions and helps discover locators; review and adapt the result so the test expresses an intentional, maintainable check.
Can I use one login account for every parallel worker?
Only when concurrent tests can safely share that account and its server-side state. Tests that modify shared state may need separate accounts per worker.
Is there a universally best worker or shard count?
No universal optimum is established by the cited Playwright guidance. Start conservatively in CI and make changes based on your suite’s stability and available capacity.
Quick Recap
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.

