playwright-cli
Playwright automation via bundled run.js. Write scripts in /tmp, execute with terminal_run from /app/codes/skills/playwright-cli.
- License 许可
- AGPL-3.0
- 最近更新
- 2026-06-17
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- playwright-cli
- description
- Playwright automation via bundled run.js. Write scripts in /tmp, execute with terminal_run from /app/codes/skills/playwright-cli.
02 资源文件 5
- 脚本lib/helpers.js13.6 KB
- 参考文档package-lock.json2.1 KB
- 参考文档package.json341 B
- 脚本pw-defaults.js1.3 KB
- 脚本run.js6.4 KB
03 SKILL.md 正文
Playwright CLI (fallback)
Use only when browser-use cannot do the job (rare). Prefer browser-use for normal browsing.
tabyAgent
- Run via
terminal_run. Skill path:/app/codes/skills/playwright-cli. - Chromium is preinstalled. Do not run
npx playwright installunless the user asks. - Docker has no display — always headless (
pwDefaults.launchOptions()). - Write scripts to
/tmp/playwright-test-*.jsonly — never the skill dir or user project.
Workflow
- Put the target URL in a
TARGET_URLconstant at the top of the script. - For localhost, detect dev servers first:
cd /app/codes/skills/playwright-cli && node -e "require('./lib/helpers').detectDevServers().then(s => console.log(JSON.stringify(s)))"
- Write the script to
/tmp/playwright-test-*.js. - Run:
cd /app/codes/skills/playwright-cli && node run.js /tmp/playwright-test-*.js
Script template
run.js injects chromium, helpers, pwDefaults, and getContextOptionsWithHeaders.
// /tmp/playwright-test-example.js
const { chromium } = require("playwright");
const pwDefaults = require("./pw-defaults");
const TARGET_URL = "https://example.com";
(async () => {
const browser = await chromium.launch(pwDefaults.launchOptions());
const context = await browser.newContext(pwDefaults.contextOptions());
const page = await context.newPage();
await pwDefaults.applyStealth(page);
await page.goto(TARGET_URL, { waitUntil: "networkidle", timeout: 30000 });
console.log("Title:", await page.title());
await page.screenshot({ path: "/tmp/screenshot.png", fullPage: true });
await browser.close();
})();
Helpers (optional)
lib/helpers.js — detectDevServers(), safeClick(), safeType(), takeScreenshot(), handleCookieBanner().
const helpers = require("./lib/helpers");
const servers = await helpers.detectDevServers();
Tips
- Always use
pwDefaults— disables automation flags, sets UA/viewport, patchesnavigator.webdriver. - Prefer
waitForSelector/waitForURLover fixedwaitForTimeout. - Use
try/catch/finallyand alwaysbrowser.close()infinally. - Screenshots and output paths:
/tmp/only.
Troubleshooting
- Module not found → run from skill dir:
cd /app/codes/skills/playwright-cli && node run.js … - Element not found →
await page.waitForSelector('.el', { timeout: 10000 }) - Install issues (rare) →
cd /app/codes/skills/playwright-cli && npm run setup
04 同仓库更多 Skills
skill-author
暂无简介
privacy
Privacy tools and alternatives to mainstream services with verified details on licensing, ads, and pricing.
k-school
(한국 사용자 전용) 학교알리미와 컴시간을 이용하여 전국 학교 시간표와 급식을 가져옵니다. 이 스킬에는 브라우저를 이용한 웹 크롤링과 비공식 API 호출 방법 및 컴시간 난독화 우회 방법이 모두 포함되어 있습니다.
find-skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
example
暂无简介
browser-use
Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, or extract information from web pages.