<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Browser Automation on KnightLi Blog</title>
        <link>https://knightli.com/en/tags/browser-automation/</link>
        <description>Recent content in Browser Automation on KnightLi Blog</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en</language>
        <lastBuildDate>Sun, 24 May 2026 23:43:35 +0800</lastBuildDate><atom:link href="https://knightli.com/en/tags/browser-automation/index.xml" rel="self" type="application/rss+xml" /><item>
        <title>How browser-harness domain skills keep AI agents from repeating browser automation mistakes</title>
        <link>https://knightli.com/en/2026/05/24/browser-harness-domain-skills-summary/</link>
        <pubDate>Sun, 24 May 2026 23:43:35 +0800</pubDate>
        
        <guid>https://knightli.com/en/2026/05/24/browser-harness-domain-skills-summary/</guid>
        <description>&lt;p&gt;The most interesting part of &lt;code&gt;browser-use/browser-harness&lt;/code&gt; is not only that it lets AI agents control real Chrome. It also turns web-operation experience into reusable &lt;code&gt;domain skills&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;That matters because browser automation is rarely difficult only because of clicking buttons. Each website has its own details:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Which pages require login.&lt;/li&gt;
&lt;li&gt;Which data can be fetched directly through an API.&lt;/li&gt;
&lt;li&gt;Which buttons do not respond to normal DOM clicks.&lt;/li&gt;
&lt;li&gt;Which iframes, shadow DOM components, or popups block the flow.&lt;/li&gt;
&lt;li&gt;Which selectors are stable and which are temporary classes.&lt;/li&gt;
&lt;li&gt;Which actions involve accounts, payments, or irreversible changes and require human confirmation.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If this experience only stays in one task log, the agent will hit the same problems again next time. &lt;code&gt;domain skills&lt;/code&gt; are meant to preserve that experience so the agent does not start from zero every time it opens a site.&lt;/p&gt;
&lt;h2 id=&#34;what-domain-skills-are&#34;&gt;What domain skills are
&lt;/h2&gt;&lt;p&gt;You can think of &lt;code&gt;domain skills&lt;/code&gt; as site-operation manuals for agents.&lt;/p&gt;
&lt;p&gt;They are not ordinary user documentation, and they are not one-off scripts. They are closer to field-tested site knowledge:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Whether the site is suitable for browser automation.&lt;/li&gt;
&lt;li&gt;Which API should be used first if an API exists.&lt;/li&gt;
&lt;li&gt;Which URL should be used when the browser is necessary.&lt;/li&gt;
&lt;li&gt;Which DOM structures, aria-labels, and button behaviors have been verified.&lt;/li&gt;
&lt;li&gt;Which common approaches fail.&lt;/li&gt;
&lt;li&gt;Which scenarios should stop and ask for human intervention.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This content can be reviewed by humans and read by agents during tasks. It turns on-the-spot exploration into maintainable experience.&lt;/p&gt;
&lt;h2 id=&#34;they-are-not-about-blind-clicking&#34;&gt;They are not about blind clicking
&lt;/h2&gt;&lt;p&gt;A good browser agent should not turn every problem into opening a webpage, looking at screenshots, and clicking buttons.&lt;/p&gt;
&lt;p&gt;One important kind of experience in &lt;code&gt;domain skills&lt;/code&gt; tells the agent when not to use the browser.&lt;/p&gt;
&lt;p&gt;For sites such as ArXiv, paper search, metadata, and abstracts can be fetched directly through the Atom API or HTML meta tags. HTTP requests are usually faster, more stable, and easier to parse than opening a browser.&lt;/p&gt;
&lt;p&gt;GitHub follows a similar pattern. Repository, user, and release data should use the REST API first. File contents should use &lt;code&gt;raw.githubusercontent.com&lt;/code&gt; first. Only pages such as GitHub Trending, which do not have an equivalent API, need browser interaction.&lt;/p&gt;
&lt;p&gt;This shows that browser-harness is not based on “the browser solves everything.” It puts the browser in the right place: when APIs, HTTP, and static pages cannot solve the problem, let the agent operate a real page.&lt;/p&gt;
&lt;h2 id=&#34;they-store-site-level-knowledge&#34;&gt;They store site-level knowledge
&lt;/h2&gt;&lt;p&gt;Traditional automation scripts are usually written around one task, for example:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Open page -&amp;gt; enter keyword -&amp;gt; click button -&amp;gt; download file
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;That script may complete the task, but the experience is scattered inside code. When the site changes, the script may fail. When the task changes, much of the experience may not be reusable.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;domain skills&lt;/code&gt; are closer to a site-level knowledge base. They care about:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Which container selector is stable in Amazon search results.&lt;/li&gt;
&lt;li&gt;Which GitHub data should go through the REST API.&lt;/li&gt;
&lt;li&gt;How LinkedIn invitation buttons differ in &lt;code&gt;aria-label&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Which Shopify Admin pages are embedded apps.&lt;/li&gt;
&lt;li&gt;Why Shopify Polaris inputs cannot always be filled with normal JS &lt;code&gt;value&lt;/code&gt; assignment.&lt;/li&gt;
&lt;li&gt;How Browser Use Cloud browser instances are created, listed, and cleaned up.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These are not steps for one task. They are decision-making knowledge that many future tasks can reuse.&lt;/p&gt;
&lt;h2 id=&#34;example-amazon-product-search&#34;&gt;Example: Amazon product search
&lt;/h2&gt;&lt;p&gt;For Amazon product search, the important part is not only how to search, but which path is more stable.&lt;/p&gt;
&lt;p&gt;A more reliable approach is to use a direct search URL instead of opening the homepage and simulating typing every time. Search results can be extracted from a container such as &lt;code&gt;[data-component-type=&amp;quot;s-search-result&amp;quot;]&lt;/code&gt;. Field extraction also has details: title, price, rating, review count, and sponsored status each have more stable DOM sources.&lt;/p&gt;
&lt;p&gt;This kind of experience is valuable for an agent. Without it, the agent may guess buttons from screenshots and repeatedly try selectors. With it, the agent can go directly to a more stable extraction path.&lt;/p&gt;
&lt;p&gt;More importantly, a skill can record traps. For example, some selectors that look usable may misread sponsored results or cross-sell areas. You only learn that from field testing.&lt;/p&gt;
&lt;h2 id=&#34;example-linkedin-invitation-management&#34;&gt;Example: LinkedIn invitation management
&lt;/h2&gt;&lt;p&gt;LinkedIn is closer to a real account workflow, and the risk is higher.&lt;/p&gt;
&lt;p&gt;On the invitation manager page, the Accept and Ignore buttons use different &lt;code&gt;aria-label&lt;/code&gt; formats. You cannot simply derive one from the other. Some invitation cards even render Accept as an &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; element rather than a &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt;, and ordinary CDP clicks may not trigger the accept action.&lt;/p&gt;
&lt;p&gt;This shows that real web automation does not end when an element is located. Button labels, event binding, soft navigation, and component implementation all affect whether an action really works.&lt;/p&gt;
&lt;p&gt;For an agent, this experience also has a safety meaning. Operations involving social accounts, invitations, messages, and posting should not be fully delegated. A skill can record the path and traps, but accepting invitations in bulk, sending content externally, or changing account details should keep human confirmation.&lt;/p&gt;
&lt;h2 id=&#34;example-shopify-admin&#34;&gt;Example: Shopify Admin
&lt;/h2&gt;&lt;p&gt;Shopify Admin shows another issue: backend systems are often not one page, but a combination of embedded apps and complex components.&lt;/p&gt;
&lt;p&gt;Many Shopify apps run inside iframes. Polaris React inputs, Web Components, and embedded apps all behave differently. Some inputs cannot be filled with &lt;code&gt;element.value = ...&lt;/code&gt;; they need CDP keystrokes that are closer to real keyboard input.&lt;/p&gt;
&lt;p&gt;The value of this kind of skill is that it lets the agent first identify what kind of UI it is looking at, then choose the right operation method.&lt;/p&gt;
&lt;p&gt;Shopify experience also emphasizes “do not use the browser if you do not have to”:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;For read-only product and inventory data, use the Storefront API first.&lt;/li&gt;
&lt;li&gt;If an Admin API token exists, use the Admin API first.&lt;/li&gt;
&lt;li&gt;For theme code editing, use Shopify CLI first.&lt;/li&gt;
&lt;li&gt;Use the browser only when there is no API, the change is rare, or you are exploring the admin.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That is a mature tool-selection logic for agents.&lt;/p&gt;
&lt;h2 id=&#34;example-browser-use-cloud&#34;&gt;Example: Browser Use Cloud
&lt;/h2&gt;&lt;p&gt;&lt;code&gt;domain skills&lt;/code&gt; do not only serve webpage clicking. They can also record API experience around browser runtimes.&lt;/p&gt;
&lt;p&gt;Browser Use Cloud experience can record how to create cloud browsers through REST APIs, list running browsers, clean up zombie browsers, and obtain &lt;code&gt;liveUrl&lt;/code&gt; and &lt;code&gt;cdpUrl&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This means a skill is not limited to “how to click a button.” Any recurring task with a stable method can become a skill:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;API call patterns.&lt;/li&gt;
&lt;li&gt;Authentication header format.&lt;/li&gt;
&lt;li&gt;Request and response structure.&lt;/li&gt;
&lt;li&gt;Verified status codes.&lt;/li&gt;
&lt;li&gt;Common failure modes.&lt;/li&gt;
&lt;li&gt;Resource cleanup and recycling methods.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For agents, all of these are reusable capabilities.&lt;/p&gt;
&lt;h2 id=&#34;why-this-is-more-reliable-than-ad-hoc-reasoning&#34;&gt;Why this is more reliable than ad-hoc reasoning
&lt;/h2&gt;&lt;p&gt;Many people expect a large model to understand the webpage by itself every time. In real tasks, relying only on ad-hoc reasoning is unstable.&lt;/p&gt;
&lt;p&gt;The reasons are simple:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Web UI changes often.&lt;/li&gt;
&lt;li&gt;The same button may have multiple implementations.&lt;/li&gt;
&lt;li&gt;Visible does not mean clickable.&lt;/li&gt;
&lt;li&gt;Clickable does not mean the action really worked.&lt;/li&gt;
&lt;li&gt;Some tasks should use APIs instead of browsers.&lt;/li&gt;
&lt;li&gt;Some operations require human confirmation and should not be decided by the model alone.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Writing these experiences into files brings several benefits:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Humans can review them.&lt;/li&gt;
&lt;li&gt;Wrong experience can be corrected.&lt;/li&gt;
&lt;li&gt;Site knowledge can accumulate over time.&lt;/li&gt;
&lt;li&gt;New agents can inherit old experience.&lt;/li&gt;
&lt;li&gt;Temporary task discoveries can become long-term knowledge.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is more stable than putting everything into a prompt or chat context.&lt;/p&gt;
&lt;h2 id=&#34;how-teams-can-use-it&#34;&gt;How teams can use it
&lt;/h2&gt;&lt;p&gt;In a team, &lt;code&gt;domain skills&lt;/code&gt; can become a lightweight automation knowledge base.&lt;/p&gt;
&lt;p&gt;Useful content to record includes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Post-login paths in internal systems.&lt;/li&gt;
&lt;li&gt;Report export flows.&lt;/li&gt;
&lt;li&gt;Common popup handling.&lt;/li&gt;
&lt;li&gt;Which buttons require human confirmation.&lt;/li&gt;
&lt;li&gt;Which pages have API alternatives.&lt;/li&gt;
&lt;li&gt;Which selectors were tested and found reliable.&lt;/li&gt;
&lt;li&gt;Which tasks agents are not allowed to run automatically.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This knowledge does not need to be complete at the beginning. A practical path is to start with low-risk, frequent, reversible workflows: read-only tasks, downloads, organization, and checks. Once the flow is stable, turn the experience into a skill.&lt;/p&gt;
&lt;p&gt;For team managers, skill files also make automation boundaries visible. You can inspect what the agent knows, what it can do, and where it should stop.&lt;/p&gt;
&lt;h2 id=&#34;boundaries-to-keep&#34;&gt;Boundaries to keep
&lt;/h2&gt;&lt;p&gt;&lt;code&gt;domain skills&lt;/code&gt; can improve an agent’s success rate, but they should not fully automate high-risk operations.&lt;/p&gt;
&lt;p&gt;Several boundaries matter:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Do not record passwords, Cookie, token, customer data, or sensitive internal URLs.&lt;/li&gt;
&lt;li&gt;Keep human confirmation for payments, deletion, bulk submission, account changes, and external publishing.&lt;/li&gt;
&lt;li&gt;Record verification date and scope.&lt;/li&gt;
&lt;li&gt;Allow skills to expire after site changes and require revalidation.&lt;/li&gt;
&lt;li&gt;Do not make bypassing risk controls or platform limits a goal.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In other words, domain skills make agents steadier. They do not give agents unlimited permission.&lt;/p&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion
&lt;/h2&gt;&lt;p&gt;The &lt;code&gt;domain skills&lt;/code&gt; mechanism in browser-harness shows one thing: AI browser automation cannot rely only on the model improvising at runtime.&lt;/p&gt;
&lt;p&gt;A usable browser agent needs at least three layers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Low-level control: screenshots, clicks, input, downloads, CDP, HTTP.&lt;/li&gt;
&lt;li&gt;Site-level knowledge: API priority, stable selectors, component traps, login boundaries.&lt;/li&gt;
&lt;li&gt;Human safety rules: do not give credentials to the model, confirm high-risk actions, and do not write sensitive information into skills.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;domain skills&lt;/code&gt; fill the second layer. They let an agent enter a web task with verified experience instead of rediscovering everything every time.&lt;/p&gt;
&lt;p&gt;References:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;browser-harness domain skills: &lt;a class=&#34;link&#34; href=&#34;https://github.com/browser-use/browser-harness/tree/main/agent-workspace/domain-skills&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/browser-use/browser-harness/tree/main/agent-workspace/domain-skills&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Amazon product-search skill: &lt;a class=&#34;link&#34; href=&#34;https://github.com/browser-use/browser-harness/blob/main/agent-workspace/domain-skills/amazon/product-search.md&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/browser-use/browser-harness/blob/main/agent-workspace/domain-skills/amazon/product-search.md&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;ArXiv scraping skill: &lt;a class=&#34;link&#34; href=&#34;https://github.com/browser-use/browser-harness/blob/main/agent-workspace/domain-skills/arxiv/scraping.md&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/browser-use/browser-harness/blob/main/agent-workspace/domain-skills/arxiv/scraping.md&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;GitHub scraping skill: &lt;a class=&#34;link&#34; href=&#34;https://github.com/browser-use/browser-harness/blob/main/agent-workspace/domain-skills/github/scraping.md&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/browser-use/browser-harness/blob/main/agent-workspace/domain-skills/github/scraping.md&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;LinkedIn invitation-manager skill: &lt;a class=&#34;link&#34; href=&#34;https://github.com/browser-use/browser-harness/blob/main/agent-workspace/domain-skills/linkedin/invitation-manager.md&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/browser-use/browser-harness/blob/main/agent-workspace/domain-skills/linkedin/invitation-manager.md&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Shopify admin skill: &lt;a class=&#34;link&#34; href=&#34;https://github.com/browser-use/browser-harness/blob/main/agent-workspace/domain-skills/shopify-admin/README.md&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/browser-use/browser-harness/blob/main/agent-workspace/domain-skills/shopify-admin/README.md&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Browser Use Cloud skill: &lt;a class=&#34;link&#34; href=&#34;https://github.com/browser-use/browser-harness/blob/main/agent-workspace/domain-skills/browser-use-cloud/cloud.md&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/browser-use/browser-harness/blob/main/agent-workspace/domain-skills/browser-use-cloud/cloud.md&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        </item>
        <item>
        <title>browser-harness, Playwright, and Puppeteer: which browser automation tool should you choose?</title>
        <link>https://knightli.com/en/2026/05/24/browser-harness-playwright-puppeteer-comparison/</link>
        <pubDate>Sun, 24 May 2026 17:51:28 +0800</pubDate>
        
        <guid>https://knightli.com/en/2026/05/24/browser-harness-playwright-puppeteer-comparison/</guid>
        <description>&lt;p&gt;In browser automation and automated testing, &lt;code&gt;Playwright&lt;/code&gt; and &lt;code&gt;Puppeteer&lt;/code&gt; are two of the most commonly compared tools. Both can control browsers, click pages, extract content, generate screenshots or PDFs, and both are closely related to Chrome DevTools Protocol.&lt;/p&gt;
&lt;p&gt;Once &lt;code&gt;browser-use/browser-harness&lt;/code&gt; is added to the picture, the question is no longer simply “which testing framework is stronger.” It becomes a comparison between two kinds of tools:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Playwright&lt;/code&gt; / &lt;code&gt;Puppeteer&lt;/code&gt;: tools for engineers to write deterministic scripts.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;browser-harness&lt;/code&gt;: a tool for AI agents to operate real browsers.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The first group fits testing, scraping, and engineered automation. The second is closer to a browser control layer for agents such as Claude Code, Codex CLI, and Gemini.&lt;/p&gt;
&lt;h2 id=&#34;the-relationship-between-playwright-and-puppeteer&#34;&gt;The relationship between Playwright and Puppeteer
&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Puppeteer&lt;/code&gt; was originally launched by the Google Chrome team and naturally focuses on Chromium and Chrome automation. Its API is concise, the ecosystem is mature, and it is especially convenient for screenshots, PDF generation, page scraping, and lightweight automation around Chrome.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Playwright&lt;/code&gt; is maintained by Microsoft, and its team has deep historical links to early Puppeteer work. It absorbed many lessons from Puppeteer and added stronger cross-browser support, auto-waiting, context isolation, test reports, and debugging tools.&lt;/p&gt;
&lt;p&gt;In short:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If you only need lightweight Chrome-based tasks, &lt;code&gt;Puppeteer&lt;/code&gt; is still very pleasant to use.&lt;/li&gt;
&lt;li&gt;If you are doing cross-browser E2E tests, complex SPA automation, or team-level test engineering, &lt;code&gt;Playwright&lt;/code&gt; is usually the better fit.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;core-differences&#34;&gt;Core differences
&lt;/h2&gt;&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Dimension&lt;/th&gt;
          &lt;th&gt;Puppeteer&lt;/th&gt;
          &lt;th&gt;Playwright&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Maintainer&lt;/td&gt;
          &lt;td&gt;Google&lt;/td&gt;
          &lt;td&gt;Microsoft&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Browser support&lt;/td&gt;
          &lt;td&gt;Mainly Chrome / Chromium&lt;/td&gt;
          &lt;td&gt;Chromium, Firefox, WebKit&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Language support&lt;/td&gt;
          &lt;td&gt;Mainly JavaScript / TypeScript&lt;/td&gt;
          &lt;td&gt;JavaScript / TypeScript, Python, Java, .NET&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Auto-waiting&lt;/td&gt;
          &lt;td&gt;More explicit waiting&lt;/td&gt;
          &lt;td&gt;Strong Locator and auto-waiting&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Context isolation&lt;/td&gt;
          &lt;td&gt;Supported, but less central&lt;/td&gt;
          &lt;td&gt;Excellent BrowserContext workflow&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Tooling&lt;/td&gt;
          &lt;td&gt;Simple, mature, foundational&lt;/td&gt;
          &lt;td&gt;Codegen, Trace Viewer, reports&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Typical use&lt;/td&gt;
          &lt;td&gt;Chrome automation, screenshots, PDF, lightweight scraping&lt;/td&gt;
          &lt;td&gt;Cross-browser E2E tests, complex frontend automation&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;browser-support&#34;&gt;Browser support
&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Puppeteer&lt;/code&gt; is strongest with Chrome. It integrates tightly with Chromium. If your goal is to control Chrome, generate PDFs, take screenshots, or run simple scraping tasks, Puppeteer has a low mental overhead.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Playwright&lt;/code&gt; is stronger for cross-browser work. It natively supports Chromium, Firefox, and WebKit. WebKit is especially important because many Safari-related issues cannot be detected through Chrome alone. For applications that need coverage across desktop, mobile, and multiple browser engines, Playwright is the better main tool.&lt;/p&gt;
&lt;p&gt;This is the first decision boundary: if you only care about Chrome, Puppeteer is fine. If you are serious about cross-browser testing, choose Playwright first.&lt;/p&gt;
&lt;h2 id=&#34;auto-waiting-and-stability&#34;&gt;Auto-waiting and stability
&lt;/h2&gt;&lt;p&gt;The most annoying part of browser automation is often not “how to click,” but whether the page is ready. An element may not be attached to the DOM, may be covered, may still be animating, or may still be disabled.&lt;/p&gt;
&lt;p&gt;In Puppeteer, you often write:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;waitForSelector&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;#submit-btn&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;click&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;#submit-btn&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;This works, but engineers must think through the waiting logic themselves. The more complex the page, the more likely the script will accumulate &lt;code&gt;waitForSelector&lt;/code&gt;, &lt;code&gt;waitForTimeout&lt;/code&gt;, and retry logic.&lt;/p&gt;
&lt;p&gt;Playwright’s Locator and auto-waiting mechanism is more complete:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;locator&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;#submit-btn&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;).&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;click&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Before clicking, Playwright checks whether the element is visible, actionable, stable, and not covered, then retries within a reasonable time. This matters a lot for modern React, Vue, and Next.js applications with heavy asynchronous rendering, and it reduces flaky tests.&lt;/p&gt;
&lt;h2 id=&#34;multi-account-workflows-and-context-isolation&#34;&gt;Multi-account workflows and context isolation
&lt;/h2&gt;&lt;p&gt;If you need to simulate multiple users, or let many tasks share one browser process while isolating Cookie, LocalStorage, and Session, &lt;code&gt;BrowserContext&lt;/code&gt; matters.&lt;/p&gt;
&lt;p&gt;Puppeteer also supports context isolation, but Playwright makes it a core capability. You can quickly create multiple independent contexts inside one browser instance. Each context behaves like a clean browser environment without repeatedly starting full browser processes.&lt;/p&gt;
&lt;p&gt;This is useful for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Multi-account concurrent tests.&lt;/li&gt;
&lt;li&gt;Multi-role workflow tests.&lt;/li&gt;
&lt;li&gt;Ecommerce, messaging, and collaborative document scenarios.&lt;/li&gt;
&lt;li&gt;Scraping tasks that need isolated Cookie and login state.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;tooling-differences&#34;&gt;Tooling differences
&lt;/h2&gt;&lt;p&gt;Playwright is the more engineering-oriented option. It includes many tools used in test development:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;codegen&lt;/code&gt;: operate on a webpage and generate scripts automatically.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Trace Viewer&lt;/code&gt;: replay screenshots, DOM snapshots, network requests, and console logs after failures.&lt;/li&gt;
&lt;li&gt;Test Runner: assertions, parallelism, retries, reports, and project matrices.&lt;/li&gt;
&lt;li&gt;Locator: element selection by text, role, label, test id, and CSS.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Puppeteer is more like a lightweight browser control library. It is not bloated, its API is direct, and it is easy to embed in scripts, server-side jobs, and custom automation flows.&lt;/p&gt;
&lt;p&gt;If you are building an enterprise-grade test system, Playwright’s tooling saves a lot of work. If you only need a Node.js script to convert webpages to PDFs or take scheduled screenshots, Puppeteer may be cleaner.&lt;/p&gt;
&lt;h2 id=&#34;where-browser-harness-fits&#34;&gt;Where browser-harness fits
&lt;/h2&gt;&lt;p&gt;&lt;code&gt;browser-harness&lt;/code&gt; is not the same kind of tool as Playwright or Puppeteer.&lt;/p&gt;
&lt;p&gt;Playwright and Puppeteer mostly assume that humans write scripts. Engineers choose selectors, waiting conditions, assertions, and exception handling. They pursue determinism: the same script should produce the same result under the same page state.&lt;/p&gt;
&lt;p&gt;browser-harness mostly assumes that an AI agent operates the browser. Its goal is not to provide a huge high-level API, but to connect to real Chrome through CDP and expose screenshots, coordinate clicks, DOM, network requests, and helpers to the agent. The agent can observe the page, decide the next step, add helpers when capabilities are missing, and turn site experience into skills.&lt;/p&gt;
&lt;p&gt;That makes it better for open-ended tasks:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Log in to a backend and download invoices.&lt;/li&gt;
&lt;li&gt;Fill a group of forms in an internal system.&lt;/li&gt;
&lt;li&gt;Handle OA or SaaS pages that change often.&lt;/li&gt;
&lt;li&gt;Explore a page according to a user goal instead of running a fixed script.&lt;/li&gt;
&lt;li&gt;Give tools such as Claude Code and Codex CLI browser operation capability.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;three-way-comparison&#34;&gt;Three-way comparison
&lt;/h2&gt;&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Dimension&lt;/th&gt;
          &lt;th&gt;Puppeteer&lt;/th&gt;
          &lt;th&gt;Playwright&lt;/th&gt;
          &lt;th&gt;browser-harness&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Target user&lt;/td&gt;
          &lt;td&gt;Engineers&lt;/td&gt;
          &lt;td&gt;Engineers and test teams&lt;/td&gt;
          &lt;td&gt;AI Agent&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Main goal&lt;/td&gt;
          &lt;td&gt;Control Chrome&lt;/td&gt;
          &lt;td&gt;Stable cross-browser automation&lt;/td&gt;
          &lt;td&gt;Let agents operate real browsers&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Script style&lt;/td&gt;
          &lt;td&gt;Hand-written JS/TS automation&lt;/td&gt;
          &lt;td&gt;Scripts plus test framework&lt;/td&gt;
          &lt;td&gt;User gives a goal, agent executes steps&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Element targeting&lt;/td&gt;
          &lt;td&gt;CSS, XPath, DOM API&lt;/td&gt;
          &lt;td&gt;Locator, text, role, CSS&lt;/td&gt;
          &lt;td&gt;Screenshots, coordinates, DOM, CDP&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Waiting&lt;/td&gt;
          &lt;td&gt;More manual control&lt;/td&gt;
          &lt;td&gt;Strong auto-waiting&lt;/td&gt;
          &lt;td&gt;Agent observes and adjusts&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Browser environment&lt;/td&gt;
          &lt;td&gt;Usually automated browser&lt;/td&gt;
          &lt;td&gt;Usually test browser&lt;/td&gt;
          &lt;td&gt;Often real Chrome&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Best fit&lt;/td&gt;
          &lt;td&gt;Chrome scripts, screenshots, PDF, lightweight scraping&lt;/td&gt;
          &lt;td&gt;E2E tests, cross-browser validation, complex SPA&lt;/td&gt;
          &lt;td&gt;AI assistants, open web tasks, real-account workflows&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;code-feel&#34;&gt;Code feel
&lt;/h2&gt;&lt;p&gt;Puppeteer feels closer to directly controlling Chrome:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;12
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;const&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;puppeteer&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;require&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;puppeteer&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;kr&#34;&gt;async&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;const&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;browser&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;puppeteer&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;launch&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;const&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;browser&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;newPage&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;kr&#34;&gt;goto&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;https://example.com&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;waitForSelector&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;#submit-btn&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;click&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;#submit-btn&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;browser&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;close&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;})();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Playwright emphasizes Locator and auto-waiting:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;const&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;chromium&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;require&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;playwright&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;kr&#34;&gt;async&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;const&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;browser&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;chromium&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;launch&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;const&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;browser&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;newPage&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;kr&#34;&gt;goto&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;https://example.com&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;locator&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;#submit-btn&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;).&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;click&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;browser&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;close&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;})();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;browser-harness feels completely different. You usually do not write a full script. You give a goal inside an agent environment:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Open the admin panel, download last month’s invoice, and organize it for reimbursement.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The agent then repeatedly uses browser-harness to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Take screenshots and understand the current page.&lt;/li&gt;
&lt;li&gt;Click a coordinate or locate an element.&lt;/li&gt;
&lt;li&gt;Enter text, upload files, and download files.&lt;/li&gt;
&lt;li&gt;Decide how to close popups.&lt;/li&gt;
&lt;li&gt;Add helper code when something is missing.&lt;/li&gt;
&lt;li&gt;Turn reusable flows into domain skills.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is not the style of traditional test scripts. It is the workflow of a browser agent.&lt;/p&gt;
&lt;h2 id=&#34;how-to-choose&#34;&gt;How to choose
&lt;/h2&gt;&lt;p&gt;Choose &lt;code&gt;Puppeteer&lt;/code&gt; when:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The project mainly runs in Node.js.&lt;/li&gt;
&lt;li&gt;You only need Chrome or Chromium.&lt;/li&gt;
&lt;li&gt;The task is screenshot, PDF generation, simple page scraping, or lightweight automation.&lt;/li&gt;
&lt;li&gt;You want a simple API, fewer dependencies, and more manual control.&lt;/li&gt;
&lt;li&gt;You rely deeply on Chrome DevTools Protocol.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Choose &lt;code&gt;Playwright&lt;/code&gt; when:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You are building standard UI automation or E2E tests.&lt;/li&gt;
&lt;li&gt;You need Chromium, Firefox, and WebKit coverage.&lt;/li&gt;
&lt;li&gt;Your team’s main language may be Python, Java, or C#.&lt;/li&gt;
&lt;li&gt;The page is a complex SPA with many asynchronous states and potential flaky tests.&lt;/li&gt;
&lt;li&gt;You need codegen, Trace Viewer, test reports, and parallel testing.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Choose &lt;code&gt;browser-harness&lt;/code&gt; when:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You are building or using AI agents.&lt;/li&gt;
&lt;li&gt;You want the model to operate a real browser like a human.&lt;/li&gt;
&lt;li&gt;The task steps are not fixed and require page-by-page judgment.&lt;/li&gt;
&lt;li&gt;The target site changes often, or has many popups, iframes, and shadow DOM.&lt;/li&gt;
&lt;li&gt;You want real web workflows handled by Claude Code, Codex CLI, or similar tools.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion
&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Playwright&lt;/code&gt; and &lt;code&gt;Puppeteer&lt;/code&gt; are browser automation tools whose core goal is to let humans write reliable scripts. Puppeteer is lighter and closer to Chrome. Playwright is more complete and better for cross-browser testing and complex frontend applications.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;browser-harness&lt;/code&gt; is a different direction. It is not designed to replace Playwright or Puppeteer for tests. It is designed to let AI agents control real browsers. It gives up some traditional script determinism in exchange for stronger adaptability in open-ended tasks.&lt;/p&gt;
&lt;p&gt;So the answer is not to pick only one. Choose by task layer:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Test engineering: prefer Playwright.&lt;/li&gt;
&lt;li&gt;Lightweight Chrome scripts: Puppeteer fits well.&lt;/li&gt;
&lt;li&gt;AI agents doing work on the web: look at browser-harness.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;References:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;browser-use/browser-harness: &lt;a class=&#34;link&#34; href=&#34;https://github.com/browser-use/browser-harness&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/browser-use/browser-harness&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Playwright documentation: &lt;a class=&#34;link&#34; href=&#34;https://playwright.dev/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://playwright.dev/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Puppeteer documentation: &lt;a class=&#34;link&#34; href=&#34;https://pptr.dev/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://pptr.dev/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Chrome DevTools Protocol: &lt;a class=&#34;link&#34; href=&#34;https://chromedevtools.github.io/devtools-protocol/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://chromedevtools.github.io/devtools-protocol/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        </item>
        <item>
        <title>What is browser-harness? A browser automation tool that lets AI agents control real Chrome</title>
        <link>https://knightli.com/en/2026/05/24/browser-use-browser-harness-ai-agent-browser-automation/</link>
        <pubDate>Sun, 24 May 2026 17:19:54 +0800</pubDate>
        
        <guid>https://knightli.com/en/2026/05/24/browser-use-browser-harness-ai-agent-browser-automation/</guid>
        <description>&lt;p&gt;&lt;code&gt;browser-use/browser-harness&lt;/code&gt; is a browser control tool for AI agents. Its goal is not to build another heavy automation framework, but to connect large language models directly to real Chrome through CDP, so they can browse pages, click, take screenshots, download files, upload files, and fill forms.&lt;/p&gt;
&lt;p&gt;The README describes the project as a thin, editable CDP harness for letting LLMs connect to a real browser. When a task lacks a helper, the agent can add code during execution and turn reusable experience into domain skills.&lt;/p&gt;
&lt;p&gt;This is worth watching because the browser is still the entry point for many real workflows: admin panels, SaaS dashboards, ecommerce sites, recruiting platforms, CRMs, reimbursement systems, cloud consoles, and document platforms. Many of them do not expose stable APIs, or their API permissions are harder to obtain than webpage access. Giving an agent reliable browser control is a way to fill that last mile of automation.&lt;/p&gt;
&lt;h2 id=&#34;what-browser-harness-is&#34;&gt;What browser-harness is
&lt;/h2&gt;&lt;p&gt;Structurally, browser-harness is closer to a browser runtime for agents than a browser extension for manual users.&lt;/p&gt;
&lt;p&gt;Its core ideas are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Connect directly to Chrome or Chromium.&lt;/li&gt;
&lt;li&gt;Control pages through a CDP WebSocket.&lt;/li&gt;
&lt;li&gt;Let agents combine screenshots, coordinate clicks, DOM inspection, network requests, and raw CDP.&lt;/li&gt;
&lt;li&gt;Put task-specific helpers in &lt;code&gt;agent-workspace/agent_helpers.py&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Store site-specific experience in &lt;code&gt;agent-workspace/domain-skills/&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Keep the core thin instead of turning it into a large automation platform.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The README says the core architecture is roughly four core files and about 1,000 lines of code, covering &lt;code&gt;install.md&lt;/code&gt;, &lt;code&gt;SKILL.md&lt;/code&gt;, &lt;code&gt;src/browser_harness/&lt;/code&gt;, &lt;code&gt;agent-workspace/agent_helpers.py&lt;/code&gt;, and &lt;code&gt;agent-workspace/domain-skills/&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The point is not to ship built-in support for every website. The point is to give the agent an operation layer close enough to a real browser, so it can fill in missing capabilities for the task at hand.&lt;/p&gt;
&lt;h2 id=&#34;how-it-differs-from-traditional-browser-automation&#34;&gt;How it differs from traditional browser automation
&lt;/h2&gt;&lt;p&gt;Traditional browser automation usually revolves around testing frameworks such as Playwright, Selenium, or Puppeteer. They are good for deterministic scripts: open a page, locate an element, click it, and assert the result.&lt;/p&gt;
&lt;p&gt;browser-harness targets a different kind of work. A user gives a goal, and the agent explores the page, judges the state, handles popups, adds helpers, and reuses site knowledge. It emphasizes adaptation during interaction.&lt;/p&gt;
&lt;p&gt;The difference can be summarized like this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Playwright is better when humans write scripts and agents run them.&lt;/li&gt;
&lt;li&gt;browser-harness is better when agents look at the page and act step by step.&lt;/li&gt;
&lt;li&gt;Traditional automation favors fixed flows.&lt;/li&gt;
&lt;li&gt;browser-harness favors open-ended tasks.&lt;/li&gt;
&lt;li&gt;Traditional scripts often depend on selectors.&lt;/li&gt;
&lt;li&gt;browser-harness encourages screenshots first, visible UI actions next, and DOM or CDP when needed.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This does not mean it replaces Playwright. For stable tests, Playwright is still more mature. browser-harness is valuable because it turns real webpages into an environment an agent can operate, especially when page structure is complex, steps are not fixed, and situational judgment matters.&lt;/p&gt;
&lt;h2 id=&#34;why-real-chrome-matters&#34;&gt;Why real Chrome matters
&lt;/h2&gt;&lt;p&gt;Many browser-agent tools use isolated headless browsers. That is simple to deploy and good for batch jobs, but it does not always reuse the user’s real working environment: login state, extensions, history, bookmarks, and daily browser setup.&lt;/p&gt;
&lt;p&gt;browser-harness supports local Chrome and the Browser Use cloud browser. For local browsers, it offers two approaches:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;chrome://inspect/#remote-debugging&lt;/code&gt; to allow the current Chrome instance to be connected.&lt;/li&gt;
&lt;li&gt;Start an isolated profile with &lt;code&gt;--remote-debugging-port=9222 --user-data-dir=...&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you want an agent to help with tasks inside real accounts, the docs lean toward the first approach because it reuses everyday Chrome login state, extensions, and bookmarks. For unattended automation, or when you do not want popups to interrupt work, an isolated profile or cloud browser is usually safer.&lt;/p&gt;
&lt;p&gt;The trade-off is clear: real Chrome is closer to the user’s workflow, but the security boundary is more sensitive. An isolated browser is easier to control, but login and environment setup must be handled again.&lt;/p&gt;
&lt;h2 id=&#34;editable-helpers-and-domain-skills&#34;&gt;Editable helpers and domain skills
&lt;/h2&gt;&lt;p&gt;The most interesting part of browser-harness is that it designs “what the agent learns” into the project structure.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;agent-workspace/agent_helpers.py&lt;/code&gt; stores helpers that are created during tasks. For example, if an agent needs to upload a file and the existing tools are not enough, it can add a stable upload helper. The next time it sees a similar page, it does not have to start from scratch.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;agent-workspace/domain-skills/&lt;/code&gt; stores site-level experience. The README mentions areas such as LinkedIn outreach, Amazon ordering, and reimbursement systems. The project recommends letting agents generate these skills from real tasks instead of hand-writing them, because they should reflect actual page behavior.&lt;/p&gt;
&lt;p&gt;This fits browser automation well. The hard part is often not “how to click a button,” but:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How a website redirects after login.&lt;/li&gt;
&lt;li&gt;Which popups block the main flow.&lt;/li&gt;
&lt;li&gt;Which selectors are stable and which are temporary class names.&lt;/li&gt;
&lt;li&gt;How uploads, downloads, iframes, shadow DOM, and cross-origin components behave.&lt;/li&gt;
&lt;li&gt;What hidden waits and asynchronous states exist in a specific backend.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If this knowledge only stays in one run log, it is quickly lost. Turning it into domain skills gives the agent a chance to improve over time.&lt;/p&gt;
&lt;h2 id=&#34;suitable-scenarios&#34;&gt;Suitable scenarios
&lt;/h2&gt;&lt;p&gt;browser-harness is better suited for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Operating real web admin panels for users.&lt;/li&gt;
&lt;li&gt;Completing repeated flows in systems without APIs.&lt;/li&gt;
&lt;li&gt;Personal or enterprise web tasks that depend heavily on login state.&lt;/li&gt;
&lt;li&gt;Complex interactions where screenshots are needed to judge page state.&lt;/li&gt;
&lt;li&gt;Agents that need to add tools and site knowledge while running.&lt;/li&gt;
&lt;li&gt;Multiple sub-agents each using an isolated browser.&lt;/li&gt;
&lt;li&gt;Researching browser-agent runtime design.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Concrete examples include organizing web tables, submitting internal forms, downloading invoices, uploading files, handling reimbursement workflows, checking order status, configuring SaaS dashboards, and extracting information from logged-in pages.&lt;/p&gt;
&lt;p&gt;If the task is only to fetch static pages, a browser may not be needed. The project’s own &lt;code&gt;SKILL.md&lt;/code&gt; also notes that static pages can often be fetched through HTTP in bulk. Browsers should be reserved for tasks that truly need page state, login state, and interaction.&lt;/p&gt;
&lt;h2 id=&#34;risks-to-watch&#34;&gt;Risks to watch
&lt;/h2&gt;&lt;p&gt;Letting an AI agent control real Chrome is powerful, but risky.&lt;/p&gt;
&lt;p&gt;First, the permission boundary must be clear. Real Chrome may contain email, payment dashboards, cloud consoles, company systems, and personal accounts. Once an agent can operate the browser, it effectively has access to part of those webpage permissions.&lt;/p&gt;
&lt;p&gt;Second, do not hand credentials to the model. For login pages, payment verification, and second confirmations, the user should handle the sensitive step. The agent can wait for login to finish, but it should not read or enter passwords, verification codes, or payment details from screenshots.&lt;/p&gt;
&lt;p&gt;Third, automation is not the same as delegation. Many web tasks look simple but may involve risk controls, mistaken clicks, data deletion, bulk submissions, or irreversible operations. Start with read-only, low-risk, reversible workflows.&lt;/p&gt;
&lt;p&gt;Fourth, domain skills should not leak private data. Site knowledge can be shared, but account names, internal URLs, customer data, coordinate logs, and one-off task details should not be written into skills.&lt;/p&gt;
&lt;p&gt;Fifth, choose the browser connection mode carefully. Reusing daily Chrome is convenient when login state matters. For long-running automation, an isolated profile or cloud browser is more controllable.&lt;/p&gt;
&lt;h2 id=&#34;why-it-matters-for-ai-agent-tools&#34;&gt;Why it matters for AI agent tools
&lt;/h2&gt;&lt;p&gt;browser-harness represents a pragmatic direction for agent tooling: build less platform, and give the model a direct interface to the real environment.&lt;/p&gt;
&lt;p&gt;Many agents fail at two ends. On one end, the model can reason but cannot touch the real page. On the other, automation frameworks are powerful but require humans to hard-code the flow. browser-harness tries to connect the two: the browser holds real-world state, while the agent observes, decides, and adds tools.&lt;/p&gt;
&lt;p&gt;That is also the meaning of a self-improving harness. It does not mean the agent magically becomes smarter. It means reusable operation experience is placed into the project structure, so the next task can avoid some of the same detours.&lt;/p&gt;
&lt;p&gt;For developers, its value is mainly in three areas:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A browser control layer for personal agents.&lt;/li&gt;
&lt;li&gt;A reference for studying browser automation and agent workflows.&lt;/li&gt;
&lt;li&gt;An experimental framework for turning web workflows into reusable skills.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It is not the answer to every browser automation problem, but it points in a clear direction: when agents truly help people do work, the tool layer should not only call APIs. It should also understand and operate the web interfaces people use every day.&lt;/p&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion
&lt;/h2&gt;&lt;p&gt;&lt;code&gt;browser-use/browser-harness&lt;/code&gt; is interesting not because it wraps many advanced features, but because it brings several key browser-agent questions into focus: real Chrome, CDP, screenshot-driven control, editable helpers, site skill accumulation, and user permission boundaries.&lt;/p&gt;
&lt;p&gt;If you are writing stable end-to-end tests, Playwright or Selenium is still a better fit. If you want agents such as Codex or Claude Code to handle real webpage tasks, browser-harness offers an entry point that matches how agents work.&lt;/p&gt;
&lt;p&gt;In practice, start with low-risk tasks: let it read pages, take screenshots, and extract information first. Then gradually try clicking and submitting. Once it can reliably understand page state, you can consider giving it longer workflows.&lt;/p&gt;
&lt;p&gt;References:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;GitHub project: &lt;a class=&#34;link&#34; href=&#34;https://github.com/browser-use/browser-harness&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/browser-use/browser-harness&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;README: &lt;a class=&#34;link&#34; href=&#34;https://github.com/browser-use/browser-harness/blob/main/README.md&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/browser-use/browser-harness/blob/main/README.md&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Installation guide: &lt;a class=&#34;link&#34; href=&#34;https://github.com/browser-use/browser-harness/blob/main/install.md&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/browser-use/browser-harness/blob/main/install.md&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Usage guide: &lt;a class=&#34;link&#34; href=&#34;https://github.com/browser-use/browser-harness/blob/main/SKILL.md&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/browser-use/browser-harness/blob/main/SKILL.md&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        </item>
        <item>
        <title>What Is CloakBrowser? A More Realistic Browser for Playwright and Puppeteer</title>
        <link>https://knightli.com/en/2026/05/19/cloakbrowser-stealth-chromium-browser-automation/</link>
        <pubDate>Tue, 19 May 2026 10:56:50 +0800</pubDate>
        
        <guid>https://knightli.com/en/2026/05/19/cloakbrowser-stealth-chromium-browser-automation/</guid>
        <description>&lt;p&gt;&lt;code&gt;CloakHQ/CloakBrowser&lt;/code&gt; is an open source project for browser automation. It is not just a Playwright configuration file or a small JavaScript patch. The project is built around a custom Chromium binary, aiming to make browser fingerprints, WebGL, Canvas, audio, fonts, GPU, screen data, WebRTC, and network timing look closer to a normal browser environment.&lt;/p&gt;
&lt;p&gt;Project URL: &lt;a class=&#34;link&#34; href=&#34;https://github.com/CloakHQ/CloakBrowser&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/CloakHQ/CloakBrowser&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;At the time of writing, the GitHub API showed about 15k stars, Python as the main language, and an MIT license. The README positions it very directly: a Stealth Chromium launcher that can replace the default Playwright or Puppeteer browser launcher.&lt;/p&gt;
&lt;h2 id=&#34;what-problem-does-it-solve&#34;&gt;What Problem Does It Solve
&lt;/h2&gt;&lt;p&gt;Many automation scripts expose obvious automation signals when they run in a regular Headless Chromium environment, for example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;navigator.webdriver&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Headless user agent traces.&lt;/li&gt;
&lt;li&gt;Unnatural plugin, font, screen, and GPU fingerprints.&lt;/li&gt;
&lt;li&gt;CDP behavior that does not match real user input.&lt;/li&gt;
&lt;li&gt;Temporary profiles without normal browsing traces.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;CloakBrowser moves part of this work into the Chromium source and binary layer, instead of relying only on runtime configuration or JavaScript patches. For Playwright users, the API still feels close to familiar browser automation, but the underlying browser is replaced with the custom build provided by the project.&lt;/p&gt;
&lt;p&gt;This type of tool is suitable for compliant automation testing, site compatibility checks, anti-abuse system self-testing, and agent browser environment experiments. It should not be used for unauthorized access, account abuse, bypassing platform risk controls, or violating service terms.&lt;/p&gt;
&lt;h2 id=&#34;basic-usage&#34;&gt;Basic Usage
&lt;/h2&gt;&lt;p&gt;Python installation:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pip install cloakbrowser
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;JavaScript / Node.js installation:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;npm install cloakbrowser playwright-core
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The Python example in the README looks close to Playwright:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;6
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;from&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;cloakbrowser&lt;/span&gt; &lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;launch&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;browser&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;launch&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;page&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;browser&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;new_page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;goto&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;https://protected-site.com&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;browser&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;close&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The JavaScript usage is also straightforward:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;6
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;launch&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;from&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;cloakbrowser&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;const&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;browser&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;launch&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;const&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;browser&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;newPage&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;kr&#34;&gt;goto&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;https://protected-site.com&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;browser&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;close&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2 id=&#34;browser-profile-manager&#34;&gt;Browser Profile Manager
&lt;/h2&gt;&lt;p&gt;CloakBrowser also provides a Browser Profile Manager. It is meant for managing browser profiles, testing environments, and repeated automation tasks more conveniently.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;docker run -p 8080:8080 -v cloakprofiles:/data cloakhq/cloakbrowser-manager
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;After starting it, open:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;http://localhost:8080
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The value of a profile manager is that the browser environment does not have to be a disposable temporary profile every time. For long-running tests, compatibility checks, and agent experiments, stable profiles are often easier to debug.&lt;/p&gt;
&lt;h2 id=&#34;how-it-differs-from-regular-playwright&#34;&gt;How It Differs From Regular Playwright
&lt;/h2&gt;&lt;p&gt;Regular Playwright focuses on reliable browser control. CloakBrowser focuses on making the browser environment itself look more natural.&lt;/p&gt;
&lt;p&gt;In practice, the difference is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Playwright provides the automation API.&lt;/li&gt;
&lt;li&gt;CloakBrowser provides a custom browser runtime.&lt;/li&gt;
&lt;li&gt;Playwright is suitable for general testing and automation.&lt;/li&gt;
&lt;li&gt;CloakBrowser is more focused on realistic browser behavior and fingerprint consistency.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This does not mean CloakBrowser can magically solve all detection problems. Websites can still use behavior, frequency, account reputation, network environment, and business rules to judge risk.&lt;/p&gt;
&lt;h2 id=&#34;what-to-watch-out-for&#34;&gt;What To Watch Out For
&lt;/h2&gt;&lt;p&gt;First, compliance matters. A more realistic automation environment does not mean unrestricted use. Automated access should respect authorization, rate limits, robots or platform rules, and service terms.&lt;/p&gt;
&lt;p&gt;Second, the project depends on a custom Chromium build. Teams should pay attention to version compatibility, security updates, and whether the binary source is acceptable for production use.&lt;/p&gt;
&lt;p&gt;Third, realistic browser behavior is only one part of the picture. If the script performs unnatural operations, sends requests too frequently, or uses accounts in abnormal ways, the result will still be risky.&lt;/p&gt;
&lt;h2 id=&#34;who-it-is-for&#34;&gt;Who It Is For
&lt;/h2&gt;&lt;p&gt;CloakBrowser is more suitable for developers and teams already using Playwright, Puppeteer, browser agents, QA automation, or web compatibility testing. It is less suitable for users who just want a no-code browser automation product.&lt;/p&gt;
&lt;h2 id=&#34;summary&#34;&gt;Summary
&lt;/h2&gt;&lt;p&gt;CloakBrowser is interesting because it moves browser automation from &amp;ldquo;just control a headless browser&amp;rdquo; toward &amp;ldquo;use a browser environment closer to real users.&amp;rdquo; For testing, agent experiments, and controlled research, it is worth watching. For real-world use, the important boundary is still compliance, authorization, and risk control.&lt;/p&gt;
</description>
        </item>
        <item>
        <title>Playwright CLI Video Recording: Recording, Chapter Markers, Overlays, and Debugging Tradeoffs</title>
        <link>https://knightli.com/en/2026/04/15/playwright-cli-video-recording/</link>
        <pubDate>Wed, 15 Apr 2026 08:22:45 +0800</pubDate>
        
        <guid>https://knightli.com/en/2026/04/15/playwright-cli-video-recording/</guid>
        <description>&lt;p&gt;If you want to record browser automation sessions as video for debugging, documentation, or proof of work, &lt;code&gt;Playwright CLI&lt;/code&gt; already provides a fairly direct workflow. It produces WebM video using the VP8/VP9 codec.&lt;/p&gt;
&lt;p&gt;This article follows the official &lt;code&gt;video-recording&lt;/code&gt; reference and focuses on the parts that matter most in practice: the basic recording flow, chapter markers, full hero-script recording, the Overlay API, and the difference between video and tracing. The command lines, code snippets, and parameter details are preserved from the reference.&lt;/p&gt;
&lt;h2 id=&#34;01-basic-recording-flow&#34;&gt;01 Basic Recording Flow
&lt;/h2&gt;&lt;p&gt;The basic pattern is simple: open the browser, start recording, perform actions, then stop and save.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;12
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;13
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;14
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;15
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;16
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;17
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;18
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;19
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Open browser first&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli open
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Start recording&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli video-start demo.webm
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Add a chapter marker for section transitions&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli video-chapter &lt;span class=&#34;s2&#34;&gt;&amp;#34;Getting Started&amp;#34;&lt;/span&gt; --description&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;Opening the homepage&amp;#34;&lt;/span&gt; --duration&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;m&#34;&gt;2000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Navigate and perform actions&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli goto https://example.com
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli snapshot
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli click e1
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Add another chapter&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli video-chapter &lt;span class=&#34;s2&#34;&gt;&amp;#34;Filling Form&amp;#34;&lt;/span&gt; --description&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;Entering test data&amp;#34;&lt;/span&gt; --duration&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;m&#34;&gt;2000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli fill e2 &lt;span class=&#34;s2&#34;&gt;&amp;#34;test input&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Stop and save&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli video-stop
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;These commands already cover the most common recording flow. &lt;code&gt;video-chapter&lt;/code&gt; is useful for inserting chapter cards between stages so the final video is easier to follow.&lt;/p&gt;
&lt;h2 id=&#34;02-best-practices&#34;&gt;02 Best Practices
&lt;/h2&gt;&lt;h3 id=&#34;1-use-descriptive-filenames&#34;&gt;1. Use Descriptive Filenames
&lt;/h3&gt;&lt;p&gt;If the video is meant for other people or for later review, the filename should include enough context to make it understandable at a glance.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Include context in filename&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli video-start recordings/login-flow-2024-01-15.webm
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli video-start recordings/checkout-test-run-42.webm
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h3 id=&#34;2-record-entire-hero-scripts&#34;&gt;2. Record Entire Hero Scripts
&lt;/h3&gt;&lt;p&gt;The official recommendation is that when a video is for a user or serves as proof of work, it is best to turn the scenario into a code snippet and execute it with &lt;code&gt;run-code&lt;/code&gt;. That gives you better control over pacing, pauses, and annotations in the video. The reference also notes that Playwright now includes APIs designed specifically for this kind of recording flow.&lt;/p&gt;
&lt;p&gt;The suggested process is:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;First perform the scenario with the CLI and note all locators and actions. You will need those locators later if you want their bounding boxes for highlight overlays.&lt;/li&gt;
&lt;li&gt;Create a dedicated script file for the video and write it in the style shown below. Use &lt;code&gt;pressSequentially&lt;/code&gt; with &lt;code&gt;delay&lt;/code&gt; for smoother typing, and add pauses where they feel natural.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;playwright-cli run-code --filename your-script.js&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Important: Overlays are &lt;code&gt;pointer-events: none&lt;/code&gt; — they do not interfere with page interactions. You can safely keep sticky overlays visible while clicking, filling, or performing any actions on the page.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;12
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;13
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;14
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;15
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;16
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;17
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;18
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;19
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;20
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;21
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;22
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;23
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;24
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;25
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;26
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;27
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;28
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;29
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;30
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;31
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;32
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;33
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;34
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;35
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;36
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;37
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;38
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;39
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;40
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;41
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;42
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;43
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;44
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;45
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;46
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;47
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;48
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;49
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;50
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;51
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;52
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;53
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;54
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;55
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;56
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;57
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;58
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;59
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;60
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;async&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;screencast&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;start&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;({&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;path&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;video.webm&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;size&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;width&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;1280&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;height&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;800&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;});&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;kr&#34;&gt;goto&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;https://demo.playwright.dev/todomvc&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;c1&#34;&gt;// Show a chapter card — blurs the page and shows a dialog.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;c1&#34;&gt;// Blocks until duration expires, then auto-removes.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;c1&#34;&gt;// Use this for simple use cases, but always feel free to hand-craft your own beautiful
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;c1&#34;&gt;// overlay via await page.screencast.showOverlay().
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;screencast&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;showChapter&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;Adding Todo Items&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;description&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;We will add several items to the todo list.&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;duration&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;2000&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;});&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;c1&#34;&gt;// Perform action
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;getByRole&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;textbox&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;name&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;What needs to be done?&amp;#39;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}).&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;pressSequentially&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;Walk the dog&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;delay&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;60&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;});&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;getByRole&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;textbox&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;name&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;What needs to be done?&amp;#39;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}).&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;press&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;Enter&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;waitForTimeout&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1000&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;c1&#34;&gt;// Show next chapter
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;screencast&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;showChapter&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;Verifying Results&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;description&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;Checking the item appeared in the list.&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;duration&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;2000&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;});&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;c1&#34;&gt;// Add a sticky annotation that stays while you perform actions.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;c1&#34;&gt;// Overlays are pointer-events: none, so they won&amp;#39;t block clicks.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;const&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;annotation&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;screencast&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;showOverlay&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;sb&#34;&gt;`
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;    &amp;lt;div style=&amp;#34;position: absolute; top: 8px; right: 8px;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;      padding: 6px 12px; background: rgba(0,0,0,0.7);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;      border-radius: 8px; font-size: 13px; color: white;&amp;#34;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;      ✓ Item added successfully
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;    &amp;lt;/div&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;  `&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;c1&#34;&gt;// Perform more actions while the annotation is visible
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;getByRole&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;textbox&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;name&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;What needs to be done?&amp;#39;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}).&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;pressSequentially&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;Buy groceries&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;delay&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;60&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;});&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;getByRole&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;textbox&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;name&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;What needs to be done?&amp;#39;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}).&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;press&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;Enter&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;waitForTimeout&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1500&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;c1&#34;&gt;// Remove the annotation when done
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;annotation&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;dispose&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;c1&#34;&gt;// You can also highlight relevant locators and provide contextual annotations.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;const&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;bounds&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;getByText&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;Walk the dog&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;).&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;boundingBox&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;screencast&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;showOverlay&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;sb&#34;&gt;`
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;    &amp;lt;div style=&amp;#34;position: absolute;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;      top: &lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;bounds&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;y&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;sb&#34;&gt;px;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;      left: &lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;bounds&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;x&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;sb&#34;&gt;px;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;      width: &lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;bounds&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;width&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;sb&#34;&gt;px;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;      height: &lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;bounds&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;height&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;sb&#34;&gt;px;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;      border: 1px solid red;&amp;#34;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;    &amp;lt;/div&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;    &amp;lt;div style=&amp;#34;position: absolute;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;      top: &lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;bounds&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;y&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;+&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;bounds&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;height&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;+&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;5&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;sb&#34;&gt;px;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;      left: &lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;bounds&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;x&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;+&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;bounds&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;width&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;/&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;sb&#34;&gt;px;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;      transform: translateX(-50%);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;      padding: 6px;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;      background: #808080;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;      border-radius: 10px;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;      font-size: 14px;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;      color: white;&amp;#34;&amp;gt;Check it out, it is right above this text
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;    &amp;lt;/div&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;sb&#34;&gt;  `&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;duration&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;2000&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;});&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kr&#34;&gt;await&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;page&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;screencast&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;stop&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The value of this script is not only that it records the flow, but that it makes the video easier to understand: chapter cards handle transitions, &lt;code&gt;pressSequentially&lt;/code&gt; makes typing look natural, and &lt;code&gt;showOverlay&lt;/code&gt; adds explanation, highlights, and context.&lt;/p&gt;
&lt;p&gt;The reference closes this section with a short reminder: Embrace creativity, overlays are powerful.&lt;/p&gt;
&lt;h2 id=&#34;03-overlay-api-summary&#34;&gt;03 Overlay API Summary
&lt;/h2&gt;&lt;p&gt;When recording video, the Overlay API is especially useful for section transitions, local callouts, and sticky annotations. The official summary is:&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Method&lt;/th&gt;
          &lt;th&gt;Use Case&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;page.screencast.showChapter(title, { description?, duration?, styleSheet? })&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Full-screen chapter card with blurred backdrop — ideal for section transitions&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;page.screencast.showOverlay(html, { duration? })&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Custom HTML overlay — use for callouts, labels, highlights&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;disposable.dispose()&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Remove a sticky overlay added without duration&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;page.screencast.hideOverlays()&lt;/code&gt; / &lt;code&gt;page.screencast.showOverlays()&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Temporarily hide/show all overlays&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;If your goal is to turn automation into a video people can comfortably watch, this API set is one of the most valuable pieces to learn first.&lt;/p&gt;
&lt;h2 id=&#34;04-tracing-vs-video&#34;&gt;04 Tracing vs Video
&lt;/h2&gt;&lt;p&gt;The official documentation makes the difference between the two very clear:&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Feature&lt;/th&gt;
          &lt;th&gt;Video&lt;/th&gt;
          &lt;th&gt;Tracing&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Output&lt;/td&gt;
          &lt;td&gt;WebM file&lt;/td&gt;
          &lt;td&gt;Trace file (viewable in Trace Viewer)&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Shows&lt;/td&gt;
          &lt;td&gt;Visual recording&lt;/td&gt;
          &lt;td&gt;DOM snapshots, network, console, actions&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Use case&lt;/td&gt;
          &lt;td&gt;Demos, documentation&lt;/td&gt;
          &lt;td&gt;Debugging, analysis&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Size&lt;/td&gt;
          &lt;td&gt;Larger&lt;/td&gt;
          &lt;td&gt;Smaller&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;A simple way to think about it:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;video&lt;/code&gt; is better for demos, delivery, and reviewing what a user would see&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tracing&lt;/code&gt; is better for debugging, inspecting action details, and analyzing execution context&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;They are not replacements for each other. Each serves a different purpose.&lt;/p&gt;
&lt;h2 id=&#34;05-limitations&#34;&gt;05 Limitations
&lt;/h2&gt;&lt;p&gt;The reference also points out two practical limitations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Recording adds slight overhead to automation&lt;/li&gt;
&lt;li&gt;Large recordings can consume significant disk space&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So while video recording is very useful, it does add some runtime overhead, and longer recordings can grow large on disk.&lt;/p&gt;
&lt;h2 id=&#34;06-quick-summary&#34;&gt;06 Quick Summary
&lt;/h2&gt;&lt;p&gt;If you only want the essentials, remember these points:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;video-start&lt;/code&gt; / &lt;code&gt;video-stop&lt;/code&gt; are the core commands for recording&lt;/li&gt;
&lt;li&gt;&lt;code&gt;video-chapter&lt;/code&gt; adds section transitions and makes demos easier to follow&lt;/li&gt;
&lt;li&gt;More advanced recording scenarios are best written as scripts and executed with &lt;code&gt;run-code&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;showOverlay&lt;/code&gt; and &lt;code&gt;showChapter&lt;/code&gt; can significantly improve video readability&lt;/li&gt;
&lt;li&gt;&lt;code&gt;video&lt;/code&gt; is best for demos, while &lt;code&gt;tracing&lt;/code&gt; is best for debugging&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If your workflow already includes automation demos, acceptance evidence, or proof-of-work recordings, &lt;code&gt;video recording&lt;/code&gt; is a very worthwhile part of &lt;code&gt;Playwright CLI&lt;/code&gt; to add.&lt;/p&gt;
&lt;h2 id=&#34;references&#34;&gt;References
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Playwright CLI video-recording reference: &lt;a class=&#34;link&#34; href=&#34;https://github.com/microsoft/playwright-cli/blob/main/skills/playwright-cli/references/video-recording.md&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/microsoft/playwright-cli/blob/main/skills/playwright-cli/references/video-recording.md&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Playwright CLI project homepage: &lt;a class=&#34;link&#34; href=&#34;https://github.com/microsoft/playwright-cli&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/microsoft/playwright-cli&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        </item>
        <item>
        <title>Playwright CLI Session Management: Multiple Browser Sessions, Isolation, Persistence, and Cleanup</title>
        <link>https://knightli.com/en/2026/04/15/playwright-cli-session-management/</link>
        <pubDate>Wed, 15 Apr 2026 08:15:12 +0800</pubDate>
        
        <guid>https://knightli.com/en/2026/04/15/playwright-cli-session-management/</guid>
        <description>&lt;p&gt;If you use &lt;code&gt;Playwright CLI&lt;/code&gt; for automation, you will quickly run into a practical question: can you open multiple browser sessions at the same time without them interfering with each other? The answer is yes, and &lt;code&gt;Playwright CLI&lt;/code&gt; already makes this mechanism quite straightforward.&lt;/p&gt;
&lt;p&gt;Following the official &lt;code&gt;session-management&lt;/code&gt; reference, this article focuses on its most practical pieces: named sessions, session isolation, persistent profiles, concurrent patterns, and common cleanup commands. The command lines and command block explanations are preserved from the reference content.&lt;/p&gt;
&lt;h2 id=&#34;01-named-browser-sessions&#34;&gt;01 Named Browser Sessions
&lt;/h2&gt;&lt;p&gt;The official recommendation is to use the &lt;code&gt;-s&lt;/code&gt; parameter to isolate different browser contexts:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;9
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Browser 1: Authentication flow&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;auth open https://app.example.com/login
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Browser 2: Public browsing (separate cookies, storage)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;public open https://example.com
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Commands are isolated by browser session&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;auth fill e1 &lt;span class=&#34;s2&#34;&gt;&amp;#34;user@example.com&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;public snapshot
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The key point here is that different &lt;code&gt;session&lt;/code&gt; names map to different browser contexts. You can use &lt;code&gt;auth&lt;/code&gt; for the sign-in flow and &lt;code&gt;public&lt;/code&gt; for anonymous browsing, and they will not share cookies or local state.&lt;/p&gt;
&lt;h2 id=&#34;02-what-does-browser-session-isolation-separate&#34;&gt;02 What Does Browser Session Isolation Separate?
&lt;/h2&gt;&lt;p&gt;Each browser session maintains the following items independently:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Cookies&lt;/li&gt;
&lt;li&gt;LocalStorage / SessionStorage&lt;/li&gt;
&lt;li&gt;IndexedDB&lt;/li&gt;
&lt;li&gt;Cache&lt;/li&gt;
&lt;li&gt;Browsing history&lt;/li&gt;
&lt;li&gt;Open tabs&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That means if you sign in to a site in the &lt;code&gt;auth&lt;/code&gt; session, it will not automatically affect the &lt;code&gt;public&lt;/code&gt; session. This is especially important for multi-account testing, login-state verification, and anonymous-vs-authenticated comparisons.&lt;/p&gt;
&lt;h2 id=&#34;03-commands-related-to-browser-sessions&#34;&gt;03 Commands Related to Browser Sessions
&lt;/h2&gt;&lt;p&gt;The official documentation groups the most commonly used session-management commands together:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;12
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;13
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;14
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;15
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;16
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# List all browser sessions&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli list
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Stop a browser session (close the browser)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli close                 &lt;span class=&#34;c1&#34;&gt;# stop the default browser&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;mysession close   &lt;span class=&#34;c1&#34;&gt;# stop a named browser&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Stop all browser sessions&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli close-all
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Forcefully kill all daemon processes (for stale/zombie processes)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli kill-all
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Delete browser session user data (profile directory)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli delete-data              &lt;span class=&#34;c1&#34;&gt;# delete default browser data&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;mysession delete-data &lt;span class=&#34;c1&#34;&gt;# delete named browser data&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;You can think of them as three kinds of operations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;list&lt;/code&gt;: see which sessions currently exist&lt;/li&gt;
&lt;li&gt;&lt;code&gt;close&lt;/code&gt; / &lt;code&gt;close-all&lt;/code&gt; / &lt;code&gt;kill-all&lt;/code&gt;: stop sessions or clean up stuck browser processes&lt;/li&gt;
&lt;li&gt;&lt;code&gt;delete-data&lt;/code&gt;: remove the user data directory for a specific session&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you just want to close a browser, &lt;code&gt;close&lt;/code&gt; is usually the first choice. If leftover or zombie processes have already appeared, &lt;code&gt;kill-all&lt;/code&gt; is the better fit.&lt;/p&gt;
&lt;h2 id=&#34;04-set-a-default-session-with-an-environment-variable&#34;&gt;04 Set a Default Session with an Environment Variable
&lt;/h2&gt;&lt;p&gt;If you do not want to repeat &lt;code&gt;-s=mysession&lt;/code&gt; on every command, the official docs also provide an environment-variable approach:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;export&lt;/span&gt; &lt;span class=&#34;nv&#34;&gt;PLAYWRIGHT_CLI_SESSION&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;mysession&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli open example.com  &lt;span class=&#34;c1&#34;&gt;# Uses &amp;#34;mysession&amp;#34; automatically&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;After that, when you do not explicitly specify &lt;code&gt;-s&lt;/code&gt;, the command will use &lt;code&gt;mysession&lt;/code&gt; as the default browser session.&lt;/p&gt;
&lt;h2 id=&#34;05-common-pattern-concurrent-scraping&#34;&gt;05 Common Pattern: Concurrent Scraping
&lt;/h2&gt;&lt;p&gt;The reference gives a very typical concurrent-scraping example:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;12
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;13
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;14
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;15
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;16
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;cp&#34;&gt;#!/bin/bash
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Scrape multiple sites concurrently&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Start all browsers&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;site1 open https://site1.com &lt;span class=&#34;p&#34;&gt;&amp;amp;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;site2 open https://site2.com &lt;span class=&#34;p&#34;&gt;&amp;amp;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;site3 open https://site3.com &lt;span class=&#34;p&#34;&gt;&amp;amp;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;wait&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Take snapshots from each&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;site1 snapshot
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;site2 snapshot
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;site3 snapshot
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Cleanup&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli close-all
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;This pattern works well when you want to open multiple sites at once, capture each page state, and then clean everything up together. Because each site runs in an independent session, they do not contaminate each other&amp;rsquo;s local state.&lt;/p&gt;
&lt;h2 id=&#34;06-common-pattern-ab-test-sessions&#34;&gt;06 Common Pattern: A/B Test Sessions
&lt;/h2&gt;&lt;p&gt;Another common scenario is comparing different experiment variants at the same time:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;7
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Test different user experiences&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;variant-a open &lt;span class=&#34;s2&#34;&gt;&amp;#34;https://app.com?variant=a&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;variant-b open &lt;span class=&#34;s2&#34;&gt;&amp;#34;https://app.com?variant=b&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Compare&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;variant-a screenshot
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;variant-b screenshot
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;This style is great for A/B page comparisons because the two variants run in separate sessions, making screenshots and state checks easier to manage independently.&lt;/p&gt;
&lt;h2 id=&#34;07-persisting-browser-profiles&#34;&gt;07 Persisting Browser Profiles
&lt;/h2&gt;&lt;p&gt;The official documentation specifically points out that browser profiles are stored only in memory by default.&lt;/p&gt;
&lt;p&gt;If you want to persist a browser profile to disk, add &lt;code&gt;--persistent&lt;/code&gt; when running &lt;code&gt;open&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;5
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Use persistent profile (auto-generated location)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli open https://example.com --persistent
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Use persistent profile with custom directory&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli open https://example.com --profile&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;/path/to/profile
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;This capability is useful when you need to reuse login state, local cache, or an extension-debugging environment over the long term. When repeatedly debugging the same site, a persistent profile is often much more efficient than starting from scratch every time.&lt;/p&gt;
&lt;h2 id=&#34;08-the-default-browser-session&#34;&gt;08 The Default Browser Session
&lt;/h2&gt;&lt;p&gt;If &lt;code&gt;-s&lt;/code&gt; is not explicitly provided, the command uses the default browser session:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# These use the same default browser session&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli open https://example.com
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli snapshot
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli close  &lt;span class=&#34;c1&#34;&gt;# Stops default browser&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;In other words, commands without &lt;code&gt;-s&lt;/code&gt; are executed continuously within the same default session.&lt;/p&gt;
&lt;h2 id=&#34;09-session-related-startup-configuration&#34;&gt;09 Session-Related Startup Configuration
&lt;/h2&gt;&lt;p&gt;In addition to the session name, the official docs also show several common startup configuration patterns:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Open with config file&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli open https://example.com --config&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;.playwright/my-cli.json
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Open with specific browser&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli open https://example.com --browser&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;firefox
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Open in headed mode&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli open https://example.com --headed
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Open with persistent profile&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli open https://example.com --persistent
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;These parameters can be combined with session management. For example, you can make one named session always run in &lt;code&gt;firefox&lt;/code&gt;, or make a specific session always launch in &lt;code&gt;headed&lt;/code&gt; mode for easier manual inspection.&lt;/p&gt;
&lt;h2 id=&#34;10-best-practices-from-the-official-docs&#34;&gt;10 Best Practices from the Official Docs
&lt;/h2&gt;&lt;p&gt;The reference lists three practical best practices.&lt;/p&gt;
&lt;h3 id=&#34;1-use-meaningful-session-names&#34;&gt;1. Use Meaningful Session Names
&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;6
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# GOOD: Clear purpose&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;github-auth open https://github.com
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;docs-scrape open https://docs.example.com
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# AVOID: Generic names&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;s1 open https://github.com
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Session names should ideally communicate their purpose directly. Names like &lt;code&gt;github-auth&lt;/code&gt; and &lt;code&gt;docs-scrape&lt;/code&gt; make later script maintenance much clearer.&lt;/p&gt;
&lt;h3 id=&#34;2-clean-up-promptly-after-use&#34;&gt;2. Clean Up Promptly After Use
&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;9
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Stop browsers when done&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;auth close
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;scrape close
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Or stop all at once&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli close-all
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# If browsers become unresponsive or zombie processes remain&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli kill-all
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;If you do not close the browser after a task finishes, the session and background processes will remain. That may not seem serious in the short term, but once tasks pile up, the environment can become messy very quickly.&lt;/p&gt;
&lt;h3 id=&#34;3-remove-stale-browser-data&#34;&gt;3. Remove Stale Browser Data
&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Remove old browser data to free disk space&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;oldsession delete-data
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;When some old sessions are no longer needed, deleting their data directories saves disk space and also helps avoid accidentally reusing outdated state later.&lt;/p&gt;
&lt;h2 id=&#34;11-quick-summary&#34;&gt;11 Quick Summary
&lt;/h2&gt;&lt;p&gt;If you only want the essentials, remember these points:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;-s=&amp;lt;name&amp;gt;&lt;/code&gt; creates and uses an independent browser session&lt;/li&gt;
&lt;li&gt;Different sessions isolate cookies, different kinds of storage, cache, history, and tabs&lt;/li&gt;
&lt;li&gt;&lt;code&gt;close-all&lt;/code&gt; is useful for unified shutdown, while &lt;code&gt;kill-all&lt;/code&gt; is useful for cleaning up abnormal leftover processes&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--persistent&lt;/code&gt; writes the profile to disk and is useful for long-term state reuse&lt;/li&gt;
&lt;li&gt;Session names should be meaningful, and old data should be cleaned up regularly&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If your workflow already includes reused login states, parallel multi-account work, A/B comparisons, or batch scraping, then &lt;code&gt;session management&lt;/code&gt; is basically one of the most worthwhile pieces of &lt;code&gt;Playwright CLI&lt;/code&gt; to learn first.&lt;/p&gt;
&lt;h2 id=&#34;references&#34;&gt;References
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Playwright CLI session-management reference: &lt;a class=&#34;link&#34; href=&#34;https://github.com/microsoft/playwright-cli/blob/main/skills/playwright-cli/references/session-management.md&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/microsoft/playwright-cli/blob/main/skills/playwright-cli/references/session-management.md&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Playwright CLI project homepage: &lt;a class=&#34;link&#34; href=&#34;https://github.com/microsoft/playwright-cli&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/microsoft/playwright-cli&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        </item>
        <item>
        <title>Playwright CLI storage state: Save Login Sessions, Read Cookies, and Local Storage</title>
        <link>https://knightli.com/en/2026/04/14/playwright-cli-storage-state-commands/</link>
        <pubDate>Tue, 14 Apr 2026 22:19:55 +0800</pubDate>
        
        <guid>https://knightli.com/en/2026/04/14/playwright-cli-storage-state-commands/</guid>
        <description>&lt;p&gt;If you use &lt;code&gt;Playwright CLI&lt;/code&gt; for browser automation, &lt;code&gt;storage state&lt;/code&gt; is one of the most useful features. Its job is simple: save the current login session and local browser state so you can reuse them later instead of logging in every time.&lt;/p&gt;
&lt;h2 id=&#34;01-save-the-current-storage-state&#34;&gt;01 Save the current storage state
&lt;/h2&gt;&lt;p&gt;The most common workflow is to log in once, then export the current state to a file.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli storage-state save auth.json
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;This command saves the current browser context state to &lt;code&gt;auth.json&lt;/code&gt;. If you want to reuse a login session later, this is usually the first step.&lt;/p&gt;
&lt;h2 id=&#34;02-load-an-existing-storage-state&#34;&gt;02 Load an existing storage state
&lt;/h2&gt;&lt;p&gt;Once you already have a state file, you can load it directly at startup.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli --storage-state auth.json
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;It launches the browser context with the state stored in &lt;code&gt;auth.json&lt;/code&gt;. The usual purpose is to skip repeated login and jump straight into a signed-in environment.&lt;/p&gt;
&lt;h2 id=&#34;03-view-current-cookies&#34;&gt;03 View current cookies
&lt;/h2&gt;&lt;p&gt;If you only want to check which cookies exist in the current session, you can inspect them directly.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli cookies
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;This command lists the cookies in the current context. It is useful when checking whether the login state exists or whether cookies were written successfully.&lt;/p&gt;
&lt;h2 id=&#34;04-set-cookies&#34;&gt;04 Set cookies
&lt;/h2&gt;&lt;p&gt;If you already have cookie data, you can inject it directly as well.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli cookies &lt;span class=&#34;nb&#34;&gt;set&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;[{&amp;#34;name&amp;#34;:&amp;#34;session&amp;#34;,&amp;#34;value&amp;#34;:&amp;#34;abc&amp;#34;,&amp;#34;domain&amp;#34;:&amp;#34;example.com&amp;#34;,&amp;#34;path&amp;#34;:&amp;#34;/&amp;#34;}]&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;This is useful for auth debugging, reproducing a specific session, or injecting cookie conditions before a script runs.&lt;/p&gt;
&lt;h2 id=&#34;05-read-localstorage&#34;&gt;05 Read localStorage
&lt;/h2&gt;&lt;p&gt;Some sites store login-related or frontend state not only in cookies, but also in &lt;code&gt;localStorage&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli local-storage
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;This command shows the &lt;code&gt;localStorage&lt;/code&gt; content of the current page. It is especially useful when a page looks logged in but still behaves incorrectly.&lt;/p&gt;
&lt;h2 id=&#34;06-write-localstorage&#34;&gt;06 Write localStorage
&lt;/h2&gt;&lt;p&gt;If you need to simulate specific frontend state, you can set it directly.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli local-storage &lt;span class=&#34;nb&#34;&gt;set&lt;/span&gt; token abc123
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;It writes the given key and value into &lt;code&gt;localStorage&lt;/code&gt;. Common uses include injecting a token, a preference, or a frontend flag.&lt;/p&gt;
&lt;h2 id=&#34;07-read-sessionstorage&#34;&gt;07 Read sessionStorage
&lt;/h2&gt;&lt;p&gt;&lt;code&gt;sessionStorage&lt;/code&gt; is useful for checking temporary state tied to the current session.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli session-storage
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;This command outputs the current page&amp;rsquo;s &lt;code&gt;sessionStorage&lt;/code&gt;. If a page flow depends on one-time session data, this is a good place to inspect it.&lt;/p&gt;
&lt;h2 id=&#34;08-write-sessionstorage&#34;&gt;08 Write sessionStorage
&lt;/h2&gt;&lt;p&gt;When needed, you can also set &lt;code&gt;sessionStorage&lt;/code&gt; manually.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli session-storage &lt;span class=&#34;nb&#34;&gt;set&lt;/span&gt; key value
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;It is useful for reproducing page behavior that depends on temporary state, or for filling in fields required by an initialization step.&lt;/p&gt;
&lt;h2 id=&#34;09-view-indexeddb&#34;&gt;09 View IndexedDB
&lt;/h2&gt;&lt;p&gt;For heavier web apps, the most important local data may actually live in &lt;code&gt;IndexedDB&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli indexed-db
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;This command lets you inspect the current page&amp;rsquo;s &lt;code&gt;IndexedDB&lt;/code&gt; data. It is worth checking first when you are dealing with complex SPAs, offline cache, or app-like local databases.&lt;/p&gt;
&lt;h2 id=&#34;10-a-practical-workflow&#34;&gt;10 A practical workflow
&lt;/h2&gt;&lt;p&gt;If your goal is simply to reuse a login session reliably, the most practical flow is usually this:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the site and complete login manually.&lt;/li&gt;
&lt;li&gt;Save the state with this command:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli storage-state save auth.json
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;Load it directly in later runs:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli --storage-state auth.json
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;If the page still behaves incorrectly after loading, continue by checking:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;playwright-cli cookies&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;playwright-cli local-storage&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;playwright-cli session-storage&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;playwright-cli indexed-db&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That sequence covers most cases where the restored state is incomplete.&lt;/p&gt;
&lt;h2 id=&#34;11-what-to-watch-out-for&#34;&gt;11 What to watch out for
&lt;/h2&gt;&lt;p&gt;Three points matter most:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;storage state&lt;/code&gt; file is sensitive data. It may contain login cookies or tokens, so do not commit it casually.&lt;/li&gt;
&lt;li&gt;Restoring cookies alone may not be enough. Many modern sites also depend on &lt;code&gt;localStorage&lt;/code&gt;, &lt;code&gt;sessionStorage&lt;/code&gt;, or &lt;code&gt;IndexedDB&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;State files do not stay valid forever. After cookie expiration, account changes, or environment changes, you usually need to generate them again.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;12-quick-summary&#34;&gt;12 Quick summary
&lt;/h2&gt;&lt;p&gt;If you only remember one sentence:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Playwright CLI&lt;/code&gt; &lt;code&gt;storage state&lt;/code&gt; means saving the browser&amp;rsquo;s current state and reusing it in later tasks.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In practice, the most useful commands are these:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;6
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli storage-state save auth.json
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli --storage-state auth.json
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli cookies
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli local-storage
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli session-storage
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli indexed-db
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Save first, then load; if something still looks wrong, inspect cookies and the different local storage layers one by one. That is the most practical part of this reference.&lt;/p&gt;
&lt;h2 id=&#34;references&#34;&gt;References
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Playwright CLI storage-state reference: &lt;a class=&#34;link&#34; href=&#34;https://github.com/microsoft/playwright-cli/blob/main/skills/playwright-cli/references/storage-state.md&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/microsoft/playwright-cli/blob/main/skills/playwright-cli/references/storage-state.md&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Playwright CLI project page: &lt;a class=&#34;link&#34; href=&#34;https://github.com/microsoft/playwright-cli&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/microsoft/playwright-cli&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        </item>
        <item>
        <title>Getting Started with Playwright CLI: Installation, Skills, Sessions, and Essential Commands</title>
        <link>https://knightli.com/en/2026/04/12/playwright-cli-getting-started/</link>
        <pubDate>Sun, 12 Apr 2026 14:36:58 +0800</pubDate>
        
        <guid>https://knightli.com/en/2026/04/12/playwright-cli-getting-started/</guid>
        <description>&lt;p&gt;If you have been using Claude Code, GitHub Copilot, or other coding agents for browser automation, &lt;code&gt;microsoft/playwright-cli&lt;/code&gt; is a tool worth watching. It is not the traditional kind of browser helper meant mainly for humans typing commands by hand. Instead, it is a Playwright CLI designed for coding agents, with an emphasis on lower token overhead, a lighter command interface, and integration with Skills-based workflows.&lt;/p&gt;
&lt;p&gt;From the official README, the core idea behind Playwright CLI is very clear: compared with MCP, which can push large tool schemas and page structure into the model context, the CLI approach is more compact and better suited for agent workflows that constantly switch between large codebases, tests, and browser automation.&lt;/p&gt;
&lt;h2 id=&#34;01-what-playwright-cli-is&#34;&gt;01 What Playwright CLI is
&lt;/h2&gt;&lt;p&gt;&lt;code&gt;playwright-cli&lt;/code&gt; is an open-source Playwright command-line tool from Microsoft. The official description is “CLI for common Playwright actions.” It is mainly used for tasks like these:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Opening pages and driving the browser&lt;/li&gt;
&lt;li&gt;Recording and generating Playwright code&lt;/li&gt;
&lt;li&gt;Capturing page snapshots to get element references&lt;/li&gt;
&lt;li&gt;Taking screenshots and exporting PDFs&lt;/li&gt;
&lt;li&gt;Working with coding agents for test automation and web interaction&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The current GitHub README is very explicit about its positioning: if you are using coding agents, the CLI is often a better fit than Playwright MCP; if you need persistent state, richer introspection, and longer-running agentic loops, MCP still has its place.&lt;/p&gt;
&lt;p&gt;In other words, Playwright CLI feels more like a browser automation interface built for AI coding assistants, not just a tool for engineers to click around manually.&lt;/p&gt;
&lt;h2 id=&#34;02-where-it-stands-out&#34;&gt;02 Where it stands out
&lt;/h2&gt;&lt;h3 id=&#34;1-it-fits-agent-workflows-better&#34;&gt;1. It fits agent workflows better
&lt;/h3&gt;&lt;p&gt;The official README lists &lt;code&gt;Token-efficient&lt;/code&gt; as a key feature. It does not force full-page data into the LLM context. Instead, it lets the agent operate the browser through shorter and more focused commands.&lt;/p&gt;
&lt;p&gt;That matters a lot for coding agents. In real projects, an agent is not only driving the browser. It also has to read code, edit files, run tests, and inspect logs. If the browser interface itself consumes too much context, the overall workflow becomes less efficient.&lt;/p&gt;
&lt;h3 id=&#34;2-it-works-well-with-skills&#34;&gt;2. It works well with Skills
&lt;/h3&gt;&lt;p&gt;The README specifically highlights &lt;code&gt;playwright-cli install --skills&lt;/code&gt;. That shows Microsoft is not treating it as just another shell utility, but as something that can be consumed directly by Claude Code, GitHub Copilot, and similar agents through a Skills-based workflow.&lt;/p&gt;
&lt;p&gt;If your setup already relies on Skills, Playwright CLI should slot in naturally.&lt;/p&gt;
&lt;h3 id=&#34;3-session-management-is-fairly-complete&#34;&gt;3. Session management is fairly complete
&lt;/h3&gt;&lt;p&gt;Playwright CLI supports sessions. By default, the browser profile stays in memory, so cookies and storage state are preserved across multiple CLI calls within the same session. If you add &lt;code&gt;--persistent&lt;/code&gt;, the profile can be saved to disk and reused across browser restarts.&lt;/p&gt;
&lt;p&gt;That makes it much more practical than tools that simply open a browser for one command and then throw everything away. It is also a better fit for long debugging cycles and longer-running agent flows.&lt;/p&gt;
&lt;h3 id=&#34;4-it-includes-a-visual-monitoring-dashboard&#34;&gt;4. It includes a visual monitoring dashboard
&lt;/h3&gt;&lt;p&gt;The README provides &lt;code&gt;playwright-cli show&lt;/code&gt;, which opens a dashboard for observing and controlling all running browser sessions. This is especially useful when an agent is running automation in the background, because you can step in, inspect progress, and help with debugging instead of flying blind.&lt;/p&gt;
&lt;h2 id=&#34;03-installation-and-requirements&#34;&gt;03 Installation and requirements
&lt;/h2&gt;&lt;p&gt;According to the current GitHub README, the basic requirements for Playwright CLI are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Node.js 18 or newer&lt;/li&gt;
&lt;li&gt;Claude Code, GitHub Copilot, or another coding agent&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The installation commands are:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;npm install -g @playwright/cli@latest
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli --help
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;There is one easy mistake worth calling out:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The officially recommended package right now is &lt;code&gt;@playwright/cli&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Do not confuse it with the old deprecated npm package &lt;code&gt;playwright-cli&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So the package you actually want is the scoped package, not the older historical one.&lt;/p&gt;
&lt;h2 id=&#34;04-how-to-start-using-it&#34;&gt;04 How to start using it
&lt;/h2&gt;&lt;h3 id=&#34;1-install-skills&#34;&gt;1. Install skills
&lt;/h3&gt;&lt;p&gt;If you want a coding agent to use Playwright CLI directly, the official recommendation is to install the skills first:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli install --skills
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The README explicitly says that Claude Code, GitHub Copilot, and similar tools will use the locally installed skills.&lt;/p&gt;
&lt;h3 id=&#34;2-let-the-agent-call-the-cli-directly&#34;&gt;2. Let the agent call the CLI directly
&lt;/h3&gt;&lt;p&gt;If you do not want to handle Skills first, you can also let the agent read the CLI help output directly:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Test the &amp;#34;add todo&amp;#34; flow on https://demo.playwright.dev/todomvc using playwright-cli.
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Check playwright-cli --help for available commands.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The README calls this “Skills-less operation.” The idea is that even without preinstalled skills, the CLI can still describe itself well enough for an agent to use it.&lt;/p&gt;
&lt;h3 id=&#34;3-try-a-minimal-flow-manually&#34;&gt;3. Try a minimal flow manually
&lt;/h3&gt;&lt;p&gt;The README includes a TodoMVC example that works very well as a first hands-on demo:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;8
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli open https://demo.playwright.dev/todomvc/ --headed
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli &lt;span class=&#34;nb&#34;&gt;type&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;Buy groceries&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli press Enter
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli &lt;span class=&#34;nb&#34;&gt;type&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;Water flowers&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli press Enter
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli check e21
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli check e35
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli screenshot
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;This sequence is useful because it quickly shows how Playwright CLI works in practice:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;open&lt;/code&gt; opens the page&lt;/li&gt;
&lt;li&gt;&lt;code&gt;type&lt;/code&gt; and &lt;code&gt;press&lt;/code&gt; handle text input&lt;/li&gt;
&lt;li&gt;&lt;code&gt;check&lt;/code&gt; uses an element reference to toggle checkboxes&lt;/li&gt;
&lt;li&gt;&lt;code&gt;screenshot&lt;/code&gt; saves the result&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;05---headed-sessions-and-the-monitoring-dashboard&#34;&gt;05 &lt;code&gt;--headed&lt;/code&gt;, sessions, and the monitoring dashboard
&lt;/h2&gt;&lt;h3 id=&#34;--headed&#34;&gt;&lt;code&gt;--headed&lt;/code&gt;
&lt;/h3&gt;&lt;p&gt;Playwright CLI is headless by default. If you want to see the browser window directly, you need to pass &lt;code&gt;--headed&lt;/code&gt; when using &lt;code&gt;open&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli open https://playwright.dev --headed
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;This is especially helpful when debugging selectors, login flows, or any interaction that is easier to inspect visually.&lt;/p&gt;
&lt;h3 id=&#34;sessions&#34;&gt;sessions
&lt;/h3&gt;&lt;p&gt;The official README places a lot of emphasis on sessions. You can use different sessions to isolate different projects or sites:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli open https://playwright.dev
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli -s&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;example open https://example.com --persistent
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli list
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;If you are letting an agent run over a longer period, you can also pass the session through an environment variable:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;PLAYWRIGHT_CLI_SESSION&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;todo-app claude .
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Useful session management commands include:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli list
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli close-all
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli kill-all
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;In practice:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;list&lt;/code&gt; shows all sessions&lt;/li&gt;
&lt;li&gt;&lt;code&gt;close-all&lt;/code&gt; closes all browsers gracefully&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kill-all&lt;/code&gt; forcefully terminates all browser processes&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;monitoring-dashboard&#34;&gt;Monitoring dashboard
&lt;/h3&gt;&lt;p&gt;If you want to see what the agent is actually doing in the browser, you can run:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli show
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;According to the README, this dashboard has two main views:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Session grid: shows active sessions by workspace, with live preview, URL, and page title&lt;/li&gt;
&lt;li&gt;Session detail: shows a live view of a selected session and lets you take over mouse and keyboard input&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That means Playwright CLI is not only usable from the command line. It also has a fairly mature observability layer.&lt;/p&gt;
&lt;h2 id=&#34;06-which-commands-are-worth-memorizing-first&#34;&gt;06 Which commands are worth memorizing first
&lt;/h2&gt;&lt;p&gt;If this is your first time using Playwright CLI, you do not need to memorize every command up front. These are the core ones worth learning first:&lt;/p&gt;
&lt;h3 id=&#34;pages-and-interaction&#34;&gt;Pages and interaction
&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;7
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli open &lt;span class=&#34;o&#34;&gt;[&lt;/span&gt;url&lt;span class=&#34;o&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli goto &amp;lt;url&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli click &amp;lt;ref&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli fill &amp;lt;ref&amp;gt; &amp;lt;text&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli &lt;span class=&#34;nb&#34;&gt;type&lt;/span&gt; &amp;lt;text&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli hover &amp;lt;ref&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli press &amp;lt;key&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h3 id=&#34;getting-page-structure&#34;&gt;Getting page structure
&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli snapshot
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli snapshot &amp;lt;ref&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli snapshot --depth&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;N
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli &lt;span class=&#34;nb&#34;&gt;eval&lt;/span&gt; &amp;lt;func&amp;gt; &lt;span class=&#34;o&#34;&gt;[&lt;/span&gt;ref&lt;span class=&#34;o&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;&lt;code&gt;snapshot&lt;/code&gt; is especially important because many later operations depend on element references stored as &lt;code&gt;ref&lt;/code&gt;. In practice, you usually capture a snapshot first, then use the returned element identifiers for clicking, filling, checking, or taking screenshots.&lt;/p&gt;
&lt;h3 id=&#34;saving-output&#34;&gt;Saving output
&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli screenshot
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli pdf
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h3 id=&#34;tabs&#34;&gt;Tabs
&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli tab-list
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli tab-new &lt;span class=&#34;o&#34;&gt;[&lt;/span&gt;url&lt;span class=&#34;o&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli tab-close &lt;span class=&#34;o&#34;&gt;[&lt;/span&gt;index&lt;span class=&#34;o&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;playwright-cli tab-select &amp;lt;index&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2 id=&#34;07-who-should-try-it&#34;&gt;07 Who should try it
&lt;/h2&gt;&lt;p&gt;Playwright CLI is especially worth trying in these kinds of scenarios:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You are using Claude Code, Copilot, or another coding agent for E2E testing&lt;/li&gt;
&lt;li&gt;You want a lighter browser automation interface without pushing large page structures into model context&lt;/li&gt;
&lt;li&gt;You want one browser session to persist across multiple commands&lt;/li&gt;
&lt;li&gt;You want to monitor agent-driven web tasks through a dashboard while they run&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If your main question is how to make browser automation work efficiently with coding agents, Playwright CLI will likely feel more natural than traditional manual debugging workflows.&lt;/p&gt;
&lt;h2 id=&#34;references&#34;&gt;References
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a class=&#34;link&#34; href=&#34;https://github.com/microsoft/playwright-cli&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/microsoft/playwright-cli&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;README: &lt;a class=&#34;link&#34; href=&#34;https://github.com/microsoft/playwright-cli/blob/main/README.md&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/microsoft/playwright-cli/blob/main/README.md&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        </item>
        
    </channel>
</rss>
