Skip to main content

Playwright 交互式调试工具

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mp_repl-0.1.44.tar.gz (21.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mp_repl-0.1.44-py3-none-any.whl (23.2 kB view details)

Uploaded Python 3

File details

Details for the file mp_repl-0.1.44.tar.gz.

File metadata

  • Download URL: mp_repl-0.1.44.tar.gz
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for mp_repl-0.1.44.tar.gz
Algorithm Hash digest
SHA256 6eb27d39928652c86c5118fd59ca8474f6336af2625ab0a037621ea8ff5f4f3d
MD5 d178b359fed4a57d240e8be3d93c309d
BLAKE2b-256 4c3e9e7ffc59a68fe5b96c7fd56203947bfcc8b63f3ff6fc1362d61c5a98c9d5

See more details on using hashes here.

File details

Details for the file mp_repl-0.1.44-py3-none-any.whl.

File metadata

  • Download URL: mp_repl-0.1.44-py3-none-any.whl
  • Upload date:
  • Size: 23.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for mp_repl-0.1.44-py3-none-any.whl
Algorithm Hash digest
SHA256 eab6aa19a446a8563a0086d4086570acd2860719820136575ecc04b7f4db6a05
MD5 8f95af314c706b497a9029fc1f3ce6bc
BLAKE2b-256 ba317b2aadc684b53284cc78f2893d015be1488d7b53559579cb7e1a1cd1e784

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page