1"use strict";(self.webpackChunkplaywright_dev=self.webpackChunkplaywright_dev||[]).push([["4851"],{69696(e,l,i){i.r(l),i.d(l,{metadata:()=>s,default:()=>h,frontMatter:()=>r,contentTitle:()=>a,toc:()=>c,assets:()=>d});var s=JSON.parse('{"id":"installation","title":"Installation","description":"Prerequisites","source":"@site/agent-cli/installation.mdx","sourceDirName":".","slug":"/installation","permalink":"/agent-cli/installation","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{"title":"Installation"},"sidebar":"agentCli","previous":{"title":"Introduction","permalink":"/agent-cli/introduction"},"next":{"title":"Quick Start","permalink":"/agent-cli/quick-start"}}'),n=i(74848),t=i(28453);let r={title:"Installation"},a="Installation",d={},c=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Global installation",id:"global-installation",level:2},{value:"Using the version in your project",id:"using-the-version-in-your-project",level:2},{value:"Initializing a workspace",id:"initializing-a-workspace",level:2},{value:"Installing skills",id:"installing-skills",level:2},{value:"Installing browsers",id:"installing-browsers",level:2},{value:"Install options",id:"install-options",level:3},{value:"Skills-less operation",id:"skills-less-operation",level:2},{value:"Environment setup",id:"environment-setup",level:2},{value:"Next steps",id:"next-steps",level:2}];function o(e){let l={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,t.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.header,{children:(0,n.jsx)(l.h1,{id:"installation",children:"Installation"})}),"\n",(0,n.jsx)(l.h2,{id:"prerequisites",children:"Prerequisites"}),"\n",(0,n.jsxs)(l.ul,{children:["\n",(0,n.jsxs)(l.li,{children:[(0,n.jsx)(l.a,{href:"https://nodejs.org/",children:"Node.js"})," 20 or newer"]}),"\n",(0,n.jsx)(l.li,{children:"A coding agent: Claude Code, GitHub Copilot, or similar"}),"\n"]}),"\n",(0,n.jsx)(l.h2,{id:"global-installation",children:"Global installation"}),"\n",(0,n.jsx)(l.pre,{children:(0,n.jsx)(l.code,{className:"language-bash",children:"npm install -g @playwright/cli@latest\nplaywright-cli --help\n"})}),"\n",(0,n.jsx)(l.h2,{id:"using-the-version-in-your-project",children:"Using the version in your project"}),"\n",(0,n.jsx)(l.p,{children:"If Playwright is already a dependency of the project, the CLI is available through it \u2014 no global\ninstall needed:"}),"\n",(0,n.jsx)(l.pre,{children:(0,n.jsx)(l.code,{className:"language-bash",children:"npx --no-install playwright --version # check that a local Playwright exists\nnpx playwright cli --help\n"})}),"\n",(0,n.jsxs)(l.p,{children:["Everywhere these docs write ",(0,n.jsx)(l.code,{children:"playwright-cli <command>"}),", ",(0,n.jsx)(l.code,{children:"npx playwright cli <command>"})," works the\nsame way."]}),"\n",(0,n.jsx)(l.h2,{id:"initializing-a-workspace",children:"Initializing a workspace"}),"\n",(0,n.jsx)(l.pre,{children:(0,n.jsx)(l.code,{className:"language-bash",children:"playwright-cli install\n"})}),"\n",(0,n.jsxs)(l.p,{children:["This creates a ",(0,n.jsx)(l.code,{children:".playwright"})," directory in the current working directory, adds it to ",(0,n.jsx)(l.code,{children:".gitignore"}),",\nand downloads the configured browser if it is missing."]}),"\n",(0,n.jsx)(l.h2,{id:"installing-skills",children:"Installing skills"}),"\n",(0,n.jsx)(l.p,{children:"Coding agents like Claude Code and GitHub Copilot use locally installed skills for richer context\nabout available commands and workflows:"}),"\n",(0,n.jsx)(l.pre,{children:(0,n.jsx)(l.code,{className:"language-bash",children:"playwright-cli install --skills # same as --skills=claude\nplaywright-cli install --skills=claude # .claude/skills/playwright-cli\nplaywright-cli install --skills=agents # .agents/skills/playwright-cli\nplaywright-cli install --skills -g # install into the home directory\n"})}),"\n",(0,n.jsxs)(l.p,{children:[(0,n.jsx)(l.code,{children:"--global"})," (alias ",(0,n.jsx)(l.code,{children:"-g"}),") installs the skill into ",(0,n.jsx)(l.code,{children:"~/.claude/skills"})," or ",(0,n.jsx)(l.code,{children:"~/.agents/skills"})," so it is\navailable in every project. It requires ",(0,n.jsx)(l.code,{children:"--skills"})," and skips the workspace initialization."]}),"\n",(0,n.jsxs)(l.p,{children:["See ",(0,n.jsx)(l.a,{href:"/agent-cli/skills",children:"Skills"})," for what the skill contains."]}),"\n",(0,n.jsx)(l.h2,{id:"installing-browsers",children:"Installing browsers"}),"\n",(0,n.jsx)(l.p,{children:"The CLI downloads a browser automatically on first use. To install explicitly:"}),"\n",(0,n.jsx)(l.pre,{children:(0,n.jsx)(l.code,{className:"language-bash",children:"playwright-cli install-browser # install the browsers this version needs\nplaywright-cli install-browser firefox # install one specific browser\nplaywright-cli install-browser --with-deps # install with system dependencies\n"})}),"\n",(0,n.jsx)(l.h3,{id:"install-options",children:"Install options"}),"\n",(0,n.jsxs)(l.table,{children:[(0,n.jsx)(l.thead,{children:(0,n.jsxs)(l.tr,{children:[(0,n.jsx)(l.th,{children:"Flag"}),(0,n.jsx)(l.th,{children:"Description"})]})}),(0,n.jsxs)(l.tbody,{children:[(0,n.jsxs)(l.tr,{children:[(0,n.jsx)(l.td,{children:(0,n.jsx)(l.code,{children:"--with-deps"})}),(0,n.jsx)(l.td,{children:"Install system dependencies (Linux)"})]}),(0,n.jsxs)(l.tr,{children:[(0,n.jsx)(l.td,{children:(0,n.jsx)(l.code,{children:"--dry-run"})}),(0,n.jsx)(l.td,{children:"Preview what would be installed"})]}),(0,n.jsxs)(l.tr,{children:[(0,n.jsx)(l.td,{children:(0,n.jsx)(l.code,{children:"--list"})}),(0,n.jsx)(l.td,{children:"List available browsers from all installations"})]}),(0,n.jsxs)(l.tr,{children:[(0,n.jsx)(l.td,{children:(0,n.jsx)(l.code,{children:"--force"})}),(0,n.jsx)(l.td,{children:"Force reinstall even if already present"})]}),(0,n.jsxs)(l.tr,{children:[(0,n.jsx)(l.td,{children:(0,n.jsx)(l.code,{children:"--only-shell"})}),(0,n.jsx)(l.td,{children:"Only install Chromium headless shell"})]}),(0,n.jsxs)(l.tr,{children:[(0,n.jsx)(l.td,{children:(0,n.jsx)(l.code,{children:"--no-shell"})}),(0,n.jsx)(l.td,{children:"Skip Chromium headless shell"})]})]})]}),"\n",(0,n.jsx)(l.h2,{id:"skills-less-operation",children:"Skills-less operation"}),"\n",(0,n.jsx)(l.p,{children:"You can also point your agent at the CLI directly and let it discover commands on its own:"}),"\n",(0,n.jsx)(l.pre,{children:(0,n.jsx)(l.code,{className:"language-txt",children:'Test the "add todo" flow on https://demo.playwright.dev/todomvc using playwright-cli.\nCheck playwright-cli --help for available commands.\n'})}),"\n",(0,n.jsx)(l.h2,{id:"environment-setup",children:"Environment setup"}
1),"\n",(0,n.jsx)(l.p,{children:"Configure your coding agent to use a specific session:"}),"\n",(0,n.jsx)(l.pre,{children:(0,n.jsx)(l.code,{className:"language-bash",children:"PLAYWRIGHT_CLI_SESSION=todo-app claude .\n"})}),"\n",(0,n.jsx)(l.h2,{id:"next-steps",children:"Next steps"}),"\n",(0,n.jsxs)(l.ul,{children:["\n",(0,n.jsxs)(l.li,{children:[(0,n.jsx)(l.a,{href:"/agent-cli/quick-start",children:"Quick Start"})," \u2014 try the CLI hands-on"]}),"\n",(0,n.jsxs)(l.li,{children:[(0,n.jsx)(l.a,{href:"/agent-cli/snapshots",children:"Snapshots"})," \u2014 how element refs work"]}),"\n",(0,n.jsxs)(l.li,{children:[(0,n.jsx)(l.a,{href:"/agent-cli/capabilities",children:"Command Reference"})," \u2014 every command, grouped"]}),"\n",(0,n.jsxs)(l.li,{children:[(0,n.jsx)(l.a,{href:"/agent-cli/configuration",children:"Configuration"})," \u2014 headless mode, browser selection, profiles"]}),"\n"]})]})}function h(e={}){let{wrapper:l}={...(0,t.R)(),...e.components};return l?(0,n.jsx)(l,{...e,children:(0,n.jsx)(o,{...e})}):o(e)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.