539aeaac91
The function is now exposed as `snapshot()` in the executor sandbox scope. `accessibilitySnapshot` remains as a backward-compatible alias pointing to the same function, so existing agents and saved commands continue to work. Updated all code examples across skill.md, README, PLAYWRITER_AGENTS, docs, tests, and the extension welcome page to use the shorter name.
400 lines
10 KiB
HTML
400 lines
10 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Welcome to Playwriter</title>
|
|
<style>
|
|
:root {
|
|
--color-bg: #ffffff;
|
|
--color-text: #262626;
|
|
--color-heading: #171717;
|
|
--color-border: #d4d4d4;
|
|
--color-code-bg: transparent;
|
|
--color-link: #0969da;
|
|
--color-link-hover: #0550ae;
|
|
--color-success: #16a34a;
|
|
--color-muted: #737373;
|
|
--max-width: 640px;
|
|
--spacing: 1.5rem;
|
|
}
|
|
|
|
@media (prefers-color-scheme: dark) {
|
|
:root {
|
|
--color-bg: #0a0a0a;
|
|
--color-text: #e5e5e5;
|
|
--color-heading: #fafafa;
|
|
--color-border: #404040;
|
|
--color-code-bg: transparent;
|
|
--color-link: #4493f8;
|
|
--color-link-hover: #539bf5;
|
|
--color-success: #22c55e;
|
|
--color-muted: #a3a3a3;
|
|
}
|
|
}
|
|
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
|
|
font-size: 16px;
|
|
line-height: 1.6;
|
|
color: var(--color-text);
|
|
background-color: var(--color-bg);
|
|
padding: 2rem 1rem;
|
|
}
|
|
|
|
main {
|
|
max-width: var(--max-width);
|
|
margin: 0 auto;
|
|
}
|
|
|
|
h2 {
|
|
font-size: 1.75rem;
|
|
font-weight: 600;
|
|
color: var(--color-heading);
|
|
margin-top: 2rem;
|
|
margin-bottom: 1rem;
|
|
padding-bottom: 0.5rem;
|
|
border-bottom: 1px solid var(--color-border);
|
|
}
|
|
|
|
h3 {
|
|
font-size: 1.25rem;
|
|
font-weight: 600;
|
|
color: var(--color-heading);
|
|
margin-top: 1.5rem;
|
|
margin-bottom: 0.75rem;
|
|
}
|
|
|
|
p {
|
|
margin-bottom: 1rem;
|
|
opacity: 0.8;
|
|
}
|
|
|
|
a {
|
|
color: var(--color-link);
|
|
text-decoration: none;
|
|
}
|
|
|
|
a:hover {
|
|
color: var(--color-link-hover);
|
|
text-decoration: underline;
|
|
}
|
|
|
|
code {
|
|
font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
|
|
font-size: 0.875em;
|
|
}
|
|
|
|
pre {
|
|
background: transparent !important;
|
|
border: none !important;
|
|
padding: 0 !important;
|
|
margin-bottom: 1rem;
|
|
overflow: visible;
|
|
white-space: pre;
|
|
}
|
|
|
|
pre code {
|
|
background: transparent !important;
|
|
padding: 0 !important;
|
|
font-size: 0.875rem;
|
|
white-space: pre;
|
|
}
|
|
|
|
ol,
|
|
ul {
|
|
margin-bottom: 1rem;
|
|
padding-left: 2rem;
|
|
}
|
|
|
|
li {
|
|
margin-bottom: 0.5rem;
|
|
opacity: 0.8;
|
|
}
|
|
|
|
strong {
|
|
font-weight: 600;
|
|
color: var(--color-heading);
|
|
}
|
|
|
|
.step-number {
|
|
color: var(--color-link);
|
|
font-weight: 700;
|
|
font-size: 1.125rem;
|
|
margin-right: 0.75rem;
|
|
flex-shrink: 0;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.step {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.step-content {
|
|
flex: 1;
|
|
min-width: 0;
|
|
}
|
|
|
|
footer {
|
|
margin-top: 3rem;
|
|
padding-top: 2rem;
|
|
border-top: 1px solid var(--color-border);
|
|
text-align: center;
|
|
color: var(--color-muted);
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
/* Tomorrow (light) token colors */
|
|
code[class*='language-'],
|
|
pre[class*='language-'] {
|
|
color: #8959a8;
|
|
text-shadow: none;
|
|
}
|
|
.token.comment,
|
|
.token.block-comment,
|
|
.token.prolog,
|
|
.token.doctype,
|
|
.token.cdata {
|
|
color: #8e908c;
|
|
}
|
|
.token.punctuation {
|
|
color: #8959a8;
|
|
}
|
|
.token.tag,
|
|
.token.attr-name,
|
|
.token.namespace,
|
|
.token.deleted {
|
|
color: #c82829;
|
|
}
|
|
.token.function-name {
|
|
color: #4271ae;
|
|
}
|
|
.token.boolean,
|
|
.token.number,
|
|
.token.function {
|
|
color: #f5871f;
|
|
}
|
|
.token.property,
|
|
.token.class-name,
|
|
.token.constant,
|
|
.token.symbol {
|
|
color: #eab700;
|
|
}
|
|
.token.selector,
|
|
.token.important,
|
|
.token.atrule,
|
|
.token.keyword,
|
|
.token.builtin {
|
|
color: #8959a8;
|
|
}
|
|
.token.string,
|
|
.token.char,
|
|
.token.attr-value,
|
|
.token.regex,
|
|
.token.variable {
|
|
color: #718c00;
|
|
}
|
|
.token.operator,
|
|
.token.entity,
|
|
.token.url {
|
|
color: #3e999f;
|
|
}
|
|
.token.inserted {
|
|
color: #718c00;
|
|
}
|
|
|
|
/* Tomorrow Night (dark) token colors */
|
|
@media (prefers-color-scheme: dark) {
|
|
code[class*='language-'],
|
|
pre[class*='language-'] {
|
|
color: #b294bb;
|
|
}
|
|
.token.comment,
|
|
.token.block-comment,
|
|
.token.prolog,
|
|
.token.doctype,
|
|
.token.cdata {
|
|
color: #969896;
|
|
}
|
|
.token.punctuation {
|
|
color: #b294bb;
|
|
}
|
|
.token.tag,
|
|
.token.attr-name,
|
|
.token.namespace,
|
|
.token.deleted {
|
|
color: #cc6666;
|
|
}
|
|
.token.function-name {
|
|
color: #81a2be;
|
|
}
|
|
.token.boolean,
|
|
.token.number,
|
|
.token.function {
|
|
color: #de935f;
|
|
}
|
|
.token.property,
|
|
.token.class-name,
|
|
.token.constant,
|
|
.token.symbol {
|
|
color: #f0c674;
|
|
}
|
|
.token.selector,
|
|
.token.important,
|
|
.token.atrule,
|
|
.token.keyword,
|
|
.token.builtin {
|
|
color: #b294bb;
|
|
}
|
|
.token.string,
|
|
.token.char,
|
|
.token.attr-value,
|
|
.token.regex,
|
|
.token.variable {
|
|
color: #b5bd68;
|
|
}
|
|
.token.operator,
|
|
.token.entity,
|
|
.token.url {
|
|
color: #8abeb7;
|
|
}
|
|
.token.inserted {
|
|
color: #b5bd68;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<main>
|
|
<section>
|
|
<h2>Getting Started with Playwriter</h2>
|
|
|
|
<p>Control your browser via Playwright API. Uses extension + CLI. No context bloat.</p>
|
|
|
|
<h3>Installation</h3>
|
|
|
|
<div class="step">
|
|
<span class="step-number">1</span>
|
|
<div class="step-content">
|
|
<strong>Pin the extension</strong>
|
|
<p>Click the puzzle icon in Chrome's toolbar, then pin Playwriter so it's always visible.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="step">
|
|
<span class="step-number">2</span>
|
|
<div class="step-content">
|
|
<strong>Enable a tab</strong>
|
|
<p>Click the extension icon on a tab. It turns green when connected.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="step">
|
|
<span class="step-number">3</span>
|
|
<div class="step-content">
|
|
<strong>Install the CLI and run a command</strong>
|
|
<pre><code class="language-bash"># install the CLI globally
|
|
npm i -g playwriter
|
|
# navigate to a URL in the active tab
|
|
playwriter -s 1 -e "await page.goto('https://example.com')"</code></pre>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="step">
|
|
<span class="step-number">4</span>
|
|
<div class="step-content">
|
|
<strong>Add the skill to your agent</strong>
|
|
<p>Install the Playwriter skill so your agent can call the CLI:</p>
|
|
<pre><code class="language-bash"># add playwriter skill to your coding agent
|
|
npx -y skills add remorses/playwriter</code></pre>
|
|
</div>
|
|
</div>
|
|
|
|
<h3>CLI Examples</h3>
|
|
|
|
<pre><code class="language-bash"># create a stateful sandbox, outputs session id (e.g. 1)
|
|
playwriter session new
|
|
# navigate to a URL
|
|
playwriter -s 1 -e "await page.goto('https://example.com')"
|
|
# get the accessibility tree of the page
|
|
playwriter -s 1 -e "console.log(await snapshot({ page }))"
|
|
# click an element by its accessibility reference
|
|
playwriter -s 1 -e "await page.locator('aria-ref=e5').click()"</code></pre>
|
|
</section>
|
|
|
|
<section>
|
|
<h2>How It Works</h2>
|
|
|
|
<ul>
|
|
<li><strong>No new Chrome instances:</strong> Works with your current browser session</li>
|
|
<li><strong>No CDP mode required:</strong> No need to restart Chrome with special flags</li>
|
|
<li><strong>Full CDP access:</strong> Complete Chrome DevTools Protocol capabilities</li>
|
|
<li><strong>Visual feedback:</strong> Extension icon changes color to indicate connection status</li>
|
|
</ul>
|
|
</section>
|
|
|
|
<section>
|
|
<h2>Icon States</h2>
|
|
|
|
<ul>
|
|
<li><strong>Gray:</strong> Not connected to any tab</li>
|
|
<li><strong>Green:</strong> Successfully connected and ready</li>
|
|
<li><strong>Orange badge (...):</strong> Connecting to relay server</li>
|
|
<li><strong>Red badge (!):</strong> Error occurred</li>
|
|
</ul>
|
|
</section>
|
|
|
|
<section>
|
|
<h2>Privacy & Security</h2>
|
|
|
|
<p>
|
|
Playwriter MCP runs locally in your browser and does not send any data to external servers. All browser
|
|
control happens through the standard Chrome DevTools Protocol on your machine.
|
|
</p>
|
|
</section>
|
|
|
|
<section>
|
|
<h2>MCP Setup (Optional)</h2>
|
|
|
|
<p>The CLI is the recommended way to use Playwriter. If you need MCP server setup, auto-configure it with:</p>
|
|
|
|
<pre><code class="language-bash"># auto-configure MCP server for your editor
|
|
npx -y @playwriter/install-mcp playwriter@latest</code></pre>
|
|
|
|
<p>
|
|
For full MCP instructions, see
|
|
<a href="https://github.com/remorses/playwriter/blob/main/MCP.md" target="_blank" rel="noopener noreferrer"
|
|
>MCP.md</a
|
|
>.
|
|
</p>
|
|
</section>
|
|
|
|
<section>
|
|
<h2>Need Help?</h2>
|
|
|
|
<p>
|
|
For issues, feature requests, or contributions, visit the
|
|
<a href="https://github.com/remorses/playwriter" target="_blank" rel="noopener noreferrer">
|
|
GitHub repository
|
|
</a>
|
|
.
|
|
</p>
|
|
</section>
|
|
|
|
<footer>
|
|
<p>Playwriter © Microsoft Corporation · Licensed under Apache-2.0</p>
|
|
</footer>
|
|
</main>
|
|
<script src="prism.min.js"></script>
|
|
<script src="prism-bash.min.js"></script>
|
|
</body>
|
|
</html>
|