pw

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

commands

命令

Use canonical ops via
pw exec
.
  • pw exec navigate --input '{"url":"..."}'
  • pw exec page.text --input '{"selector":"..."}'
  • pw exec page.html --input '{"selector":"..."}'
  • pw exec click --input '{"selector":"..."}'
  • pw exec fill --input '{"selector":"...","text":"..."}'
  • pw exec screenshot --input '{"output":"page.png"}'
  • pw exec page.eval --input '{"expression":"..."}'
  • pw exec page.read --input '{}'
For NDJSON loops, use
pw batch
.
通过
pw exec
使用标准操作。
  • pw exec navigate --input '{"url":"..."}'
  • pw exec page.text --input '{"selector":"..."}'
  • pw exec page.html --input '{"selector":"..."}'
  • pw exec click --input '{"selector":"..."}'
  • pw exec fill --input '{"selector":"...","text":"..."}'
  • pw exec screenshot --input '{"output":"page.png"}'
  • pw exec page.eval --input '{"expression":"..."}'
  • pw exec page.read --input '{}'
对于NDJSON循环,使用
pw batch

setup

设置

start daemon for fast warm execution:
bash
scripts/start-daemon.sh
browser session management is via canonical
connect
op:
  • launch:
    pw exec connect --input '{"launch":true}'
  • discover:
    pw exec connect --input '{"discover":true}'
  • clear:
    pw exec connect --input '{"clear":true}'
auth in
./playwright/auth/*.json
is auto-injected when configured.
启动守护进程以实现快速预热执行:
bash
scripts/start-daemon.sh
浏览器会话管理通过标准
connect
操作实现:
  • 启动:
    pw exec connect --input '{"launch":true}'
  • 发现:
    pw exec connect --input '{"discover":true}'
  • 清除:
    pw exec connect --input '{"clear":true}'
配置后,
./playwright/auth/*.json
中的认证信息会自动注入。

context

上下文

runtime/profile state is profile-scoped under
.pw-cli-v4
. use
--profile <name>
for isolation.
运行时/配置文件状态在
.pw-cli-v4
下按配置文件划分作用域。 使用
--profile <name>
实现隔离。

wrappers

包装器

scripts/pw.nu
exposes stable helpers (
pw nav
,
pw click
,
pw eval
, etc.) but internally calls only
pw exec
.
scripts/pw.nu
提供稳定的辅助工具(
pw nav
pw click
pw eval
等),但其内部仅调用
pw exec

references

参考资料

  • cli | auth | connect | daemon
  • page | protect | run | test
  • cli | auth | connect | daemon
  • page | protect | run | test