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.0.tar.gz (305.7 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.0-py3-none-any.whl (359.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: playwright_ez-2.6.0.tar.gz
  • Upload date:
  • Size: 305.7 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.0.tar.gz
Algorithm Hash digest
SHA256 23b632a398d9df15a2465274c6be67772da392dafe1b85801596636aee8bb2ec
MD5 419cbde4de7769626816d5cdfb896f47
BLAKE2b-256 efba0f57c150be190a80ed972ae5a2723dc115bd11f0643926aede0efa5b8e9b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: playwright_ez-2.6.0-py3-none-any.whl
  • Upload date:
  • Size: 359.0 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 70bb8582536e5729b13d556b86778d1dd41f54f5238ea7265f5273d774a9cae5
MD5 caa3ead091c03fc327efaef215318b9e
BLAKE2b-256 4c82adfbd6e9032b76a89d05597d345c5272f580fded12a4a132678d23be0994

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