playwriter

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

REQUIRED: Read Full Documentation First

必读:先阅读完整文档

Before using playwriter, you MUST run this command:
bash
playwriter skill
This outputs the complete documentation including:
  • Session management and timeout configuration
  • Selector strategies (and which ones to AVOID)
  • Rules to prevent timeouts and failures
  • Best practices for slow pages and SPAs
  • Context variables, utility functions, and more
Do NOT skip this step. The quick examples below will fail without understanding timeouts, selector rules, and common pitfalls from the full docs.
在使用playwriter之前,你必须运行以下命令:
bash
playwriter skill
该命令会输出完整文档,包括:
  • 会话管理与超时配置
  • 选择器策略(以及需要避免的类型)
  • 防止超时和执行失败的规则
  • 针对慢加载页面和SPA的最佳实践
  • 上下文变量、实用函数等更多内容
请勿跳过此步骤。 如果不了解完整文档中的超时设置、选择器规则和常见陷阱,下面的快速示例将会执行失败。

Minimal Example (after reading full docs)

最简示例(阅读完整文档后使用)

bash
playwriter session new
playwriter -s 1 -e "await page.goto('https://example.com')"
If
playwriter
is not found, use
npx playwriter@latest
or
bunx playwriter@latest
.
bash
playwriter session new
playwriter -s 1 -e "await page.goto('https://example.com')"
如果找不到
playwriter
命令,请使用
npx playwriter@latest
bunx playwriter@latest