Skip to main content

mp-repl

Playwright 交互式调试工具 - 提升自动化脚本开发效率

安装

pip install mp-repl
playwright install chromium

快速开始

# 启动 REPL(自动重连上次的浏览器)
pw-repl

# 连接浏览器
pw> connect 127.0.0.1:9222

# 快捷导航
pw> go github
pw> go kaggle

# 页面操作
pw> btn 'Sign in'
pw> fill '#email' 'test@example.com'
pw> click '#submit'

# 执行 Playwright 代码
pw> page.locator('button').click()
pw> await page.title()

# 变量赋值
pw> mypage = page
pw> title = await page.title()

# 加载并执行脚本
pw> run my_script.py
pw> my_function()

会话管理

# 列出会话(自动检测当前平台)
pw> sessions
  [0] github/user1
  [1] github/user2

# 加载会话
pw> session 0
✓ Session loaded: github/user1
✓ Page reloaded

# 保存会话
pw> save myuser
✓ Created: github/myuser
✓ Session saved

# 清理会话
pw> clear           # 当前页面
pw> clear --all     # 所有

主要功能

  • 快捷导航:go kaggle, go github, go google
  • 页面操作:btn, click, fill, txt, wait
  • Playwright 执行:page.xxx, browser.xxx
  • 脚本执行:run, funcs, 支持 debug() 断点
  • 多 Tab 管理:pages, page <index>
  • 会话管理:sessions, session, save, clear
  • 历史记录:history, r <index>

文档

详见 docs/design.md

License

MIT

Metadata

Release files for mp-repl 0.1.45

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mp-repl 0.1.45
File Size Uploaded
mp_repl-0.1.45.tar.gz 21.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mp-repl 0.1.45
File Interpreter ABI Platform
mp_repl-0.1.45-py3-none-any.whl Python 3 none any Details

Total release size: 45.0 kB

Release files / mp_repl-0.1.45.tar.gz

Download URL mp_repl-0.1.45.tar.gz
Size 21.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6982e2a913b23e549ec95d88fca08b4716c75f1da9368119b2aa66c38f6160b4
BLAKE2b-256 checksum
How to use checksums
e6179191687a65c67a38a285491b7609f4997f82d9c445d81c10cbf0ca3ee680
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / mp_repl-0.1.45-py3-none-any.whl

Download URL mp_repl-0.1.45-py3-none-any.whl
Size 23.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
adb8f0c43c7e1003c15cdc84833b606013907498eb0b4449c29c35f6d912537f
BLAKE2b-256 checksum
How to use checksums
a33b7a9b8f1d4cffef57292f7bf1dfa255989eefce2762282fa9ba87e23e229d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release history Release notifications | RSS feed

This release

0.1.45 This release

2 release files

0.1.44

2 release files

0.1.43

2 release files

0.1.42

2 release files

0.1.41

2 release files

0.1.40

2 release files

0.1.39

2 release files

0.1.38

2 release files

0.1.37

2 release files

0.1.36

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page