Skip to main content

A simplified Playwright wrapper with multi-tab support, element highlighting, and smart waiting

Project description

Playwright-EZ 🎭

一个功能全面、简单易用的 Playwright 封装库,让浏览器自动化变得简单高效。

✨ 核心特性

🗂️ 多标签页管理

创建、切换、关闭标签页,并行/顺序执行操作

🎨 元素高亮

操作元素时自动高亮显示,方便调试

⏳ 智能等待

13种等待条件,自定义条件,带重试执行

🔍 智能选择器

CSS/XPath/Text/Role/Placeholder/Label/链式选择器

🍪 Cookie & Session管理

保存/加载Cookie,会话状态管理

🌐 网络监控 & 拦截

请求日志、API追踪、拦截、模拟响应

📁 文件操作

上传/下载文件、批量上传、PDF转换

🛡️ 反检测

隐藏自动化特征、人类化操作

📝 表单处理

智能填充、验证、登录表单快捷操作

🏗️ 页面对象模型(POM)

BasePage、PageFactory、步骤装饰器

📊 性能分析

页面加载指标、Web Vitals、资源分析

📱 移动端模拟

20+预定义设备、GPS定位、网络条件模拟

👁️ 视觉测试

截图对比、差异检测、报告生成

🎬 操作录制回放

录制操作、回放、代码自动生成

🐛 调试工具

调试信息捕获、错误处理、断言库

📤 数据提取

表格/列表提取、JSON-LD、结构化数据

🔌 API测试

HTTP请求、Mock服务、GraphQL支持

🔗 WebSocket监控

WS连接监控、消息拦截、录制回放

🧪 Pytest集成

Fixtures、Hooks、测试报告

💻 命令行工具

截图、录制、回放、抓取命令

🔐 验证码处理

验证码识别辅助、滑动验证码处理

🎲 数据生成

测试数据生成器,支持多种数据类型

📈 测试报告

HTML报告、性能报告、覆盖率报告

💾 数据库操作

SQLite数据库简化操作

⚙️ 环境管理

多环境配置、密钥管理

📦 安装

pip install playwright-ez
playwright install chromium

🚀 快速开始

import asyncio
from playwright_ez import EasyBrowser

async def main():
    async with EasyBrowser() as browser:
        # 导航
        await browser.goto("https://example.com")
        
        # 操作(自动高亮+智能等待)
        await browser.click("button.submit")
        await browser.type_text("input.email", "test@example.com")
        
        # 获取内容
        text = await browser.get_text("h1")
        print(text)

asyncio.run(main())

📚 文档

详细文档请参考项目源码中的docstring。

📄 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

playwright_ez-2.6.2.tar.gz (308.5 kB view details)

Uploaded Source

Built Distribution

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

playwright_ez-2.6.2-py3-none-any.whl (362.2 kB view details)

Uploaded Python 3

File details

Details for the file playwright_ez-2.6.2.tar.gz.

File metadata

  • Download URL: playwright_ez-2.6.2.tar.gz
  • Upload date:
  • Size: 308.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for playwright_ez-2.6.2.tar.gz
Algorithm Hash digest
SHA256 9c5fbcb13968ac81ab9c9a0ca5abb9c7a970fbf84d389784d66c1a67cd4616ae
MD5 353d31ae31dfa4535fab019447970969
BLAKE2b-256 96d54f427b89f6638fa1624ab094f55a6a4a2fbd34d1ea7720b2814d7ebeee21

See more details on using hashes here.

File details

Details for the file playwright_ez-2.6.2-py3-none-any.whl.

File metadata

  • Download URL: playwright_ez-2.6.2-py3-none-any.whl
  • Upload date:
  • Size: 362.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for playwright_ez-2.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7735a281fdeecf07cae8429328c7674786122f9169a60f8262fa03dbe3899cef
MD5 1022d362b54128dc212518b7a1c6b97d
BLAKE2b-256 922f28cf6ddc84e2b81b4d02f766504262ab3fc9dbbadd27b45054adae0b573b

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