Chuyển đến nội dung
Skillpedia
Kiểm thử28k · #9860

playwright-interactive

Skill này làm gì

Skill này cho phép agent mở và điều khiển một ứng dụng đang chạy trong một phiên trình duyệt vẫn mở giữa các bước. Nó dành cho lập trình viên muốn gỡ lỗi và kiểm thử giao diện người dùng trong khi làm việc.

Khi nào nên dùng

  • ✓Khi bạn muốn gỡ lỗi từng bước một ứng dụng web cục bộ hoặc ứng dụng Electron.
  • ✓Khi bạn cần kiểm tra giao diện trông thế nào sau mỗi thay đổi.
  • ✓Khi bạn muốn kiểm tra chức năng và trực quan mà không phải khởi động lại trình duyệt mỗi lần.

Liên kết skill

https://github.com/openai/skills/blob/main/skills/.curated/playwright-interactive/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/openai/skills/blob/main/skills/.curated/playwright-interactive/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Mở ứng dụng cục bộ của tôi trong trình duyệt, bấm qua form đăng ký và cho tôi biết chỗ nào bị hỏng.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent thiết lập Playwright trong một môi trường mã bền vững, giữ các tham chiếu trình duyệt sống qua các bước và báo cáo những gì nó thấy, kèm ảnh chụp màn hình.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Playwright Interactive Skill

Use a persistent js_repl Playwright session to debug local web or Electron apps, keep the same handles alive across iterations, and run functional plus visual QA without restarting the whole toolchain unless the process ownership changed.

Preconditions

  • js_repl must be enabled for this skill.
  • If js_repl is missing, enable it in ~/.codex/config.toml:
[features]
js_repl = true
  • You can also start a new session with --enable js_repl (equivalent to -c features.js_repl=true).
  • After enabling js_repl, start a new Codex session so the tool list refreshes.
  • For now, run this workflow with sandboxing disabled: start Codex with --sandbox danger-full-access (or the equivalent config for sandbox_mode=danger-full-access). This is a temporary requirement while js_repl + Playwright support inside the sandbox is still being completed.
  • Run setup from the same project directory you need to debug.
  • Treat js_repl_reset as a recovery tool, not routine cleanup. Resetting the kernel destroys your Playwright handles.

One-time setup

test -f package.json || npm init -y
npm install playwright
# Web-only, for headed Chromium or mobile emulation:
# npx playwright install chromium
# Electron-only, and only if the target workspace is the app itself:
# npm install --save-dev electron
node -e "import('playwright').then(() => console.log('playwright import ok')).catch((error) => { console.error(error); process.exit(1); })"

If you switch to a different workspace later, repeat setup there.

Core Workflow

  1. Write a brief QA inventory before testing:
    • Build the inventory from three sources: the user's requested requirements, the user-visible features or behaviors you actually implemented, and the claims you expect to make in the final response.
    • Anything that appears in any of those three sources must map to at least one QA check before signoff.
    • List the user-visible claims you intend to sign off on.
    • List every meaningful user-facing control, mode switch, or implemented interactive behavior.
    • List the state changes or view changes each control or implemented behavior can cause.
    • Use this as the shared coverage list for both functional QA and visual QA.
    • For each claim or control-state pair, note the intended functional check, the specific state where the visual check must happen, and the evidence you expect to capture.
    • If a requirement is visually central but subjective, convert it into an observable QA check instead of leaving it implicit.
    • Add at least 2 exploratory or off-happy-path scenarios that could expose fragile behavior.
  2. Run the bootstrap cell once.
  3. Start or confirm any required dev server in a persistent TTY session.
  4. Launch the correct runtime and keep reusing the same Playwright handles.
  5. After each code change, reload for renderer-only changes or relaunch for main-process/startup changes.
  6. Run functional QA with normal user input.
  7. Run a separate visual QA pass.
  8. Verify viewport fit and capture the screenshots needed to support your claims.
  9. Clean up the Playwright session only when the task is actually finished.

Bootstrap (Run Once)

var chromium;
var electronLauncher;
var browser;
var context;
var page;
var mobileContext;
var mobilePage;
var electronApp;
var appWindow;

try {
  ({ chromium, _electron: electronLauncher } = await import("playwright"));
  console.log("Playwright loaded");
} catch (error) {
  throw new Error(
    `Could not load playwright from the current js_repl cwd. Run the setup commands from this workspace first. Original error: ${error}`
  );
}

Binding rules:

  • Use var for the shared top-level Playwright handles because later js_repl cells reuse them.
  • The setup cells below are intentionally short happy paths. If a handle looks stale, set that binding to undefined and rerun the cell instead of adding recovery logic everywhere.
  • Prefer one named handle per surface you care about (page, mobilePage, appWindow) over repeatedly rediscovering pages from the context.

Shared web helpers:

var resetWebHandles = function () {
  context = undefined;
  page = undefined;
  mobileContext = undefined;
  mobilePage = undefined;
};

var ensureWebBrowser = async function () {
  if (browser && !browser.isConnected()) {
    browser = undefined;
    resetWebHandles();
  }

  browser ??= await chromium.launch({ headless: false });
Câu hỏi thường gặp

Nó có cần thiết lập đặc biệt không?

Có. Tính năng js_repl phải được bật và Playwright phải được cài trong dự án.

Vì sao tôi phải chạy mà không có sandbox?

Skill nói rằng đây là yêu cầu tạm thời trong khi hỗ trợ Playwright bên trong sandbox đang được hoàn thiện.

Nó có bao gồm ứng dụng Electron không?

Có. Skill bao quát cả ứng dụng web và ứng dụng Electron.

Chi tiết

Mô tả gốc của tác giả

Persistent browser and Electron interaction through `js_repl` for fast iterative UI debugging.

repo: openai/skills

Độ phổ biến

Sao GitHub
28k
Vị trí xếp hạng
#9860
Giấy phép
—
Cập nhật
28/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự