Back to MCP directory
publicPublicdnsLocal runtime

playwright-7mj

Playwright是一个跨浏览器的Web测试和自动化框架,支持Chromium、Firefox和WebKit,提供无头执行、多浏览器兼容性测试、强大的断言和工具支持,适用于多种编程语言。

article

README

🚀 Playwright 测试框架指南

Playwright 是一款强大的自动化测试工具,可用于浏览器、移动应用以及电子表格的测试。它能有效提升开发者的工作效率,还能简化跨平台测试的流程。

🚀 快速开始

Playwright 是一个强大的自动化测试工具,支持浏览器、移动应用和电子表格测试。它帮助开发者提高工作效率,并简化跨平台测试的流程。

📦 安装指南

安装命令

npm install -g playwright

初始化项目

在项目根目录运行以下命令:

playwright init

运行测试

使用以下命令运行 Playwright 测试:

npx playwright test

✨ 主要特性

1. 浏览器自动化

  • 支持 Chromium、WebKit 和 Firefox。
  • 提供完整的浏览器功能,包括 cookie、本地存储和权限管理。

2. 移动应用测试

  • 模拟真实设备和平板电脑的屏幕尺寸、分辨率和方向。
  • 支持多指手势操作。

3. 电子表格测试

  • 测试 Google Sheets 和 Excel 文件。
  • 支持单元格选择、编辑和公式计算。

💻 使用示例

基础用法

import { test } from '@playwright/test';

test('Browser Automation', async ({ page }) => {
  await page.goto('https://example.com');
  const title = await page.title();
  console.log(`页面标题为: ${title}`);
});

高级用法

移动应用测试

import { test, devices } from '@playwright/test';

test.use({
  ...devices.iPhone14ProMax.landscape,
  screenSize: '1960x852'
});

test('Mobile Testing', async ({ page }) => {
  await page.goto('https://m.example.com');
});

电子表格测试

import { test, device } from '@playwright/test';

test.use({
  ...device iPadOS,
  screenSize: '820x1104'
});

test('Excel Testing', async ({ page }) => {
  await page.goto('https://docs.google.com/spreadsheets/u/0');
});

📚 详细文档

你可以通过以下链接获取更多关于 Playwright 的详细信息:

Playwright 是一个功能强大的测试工具,适用于浏览器、移动应用和电子表格测试。它帮助开发者提高工作效率,并简化跨平台测试的流程。

如果需要进一步了解 Playwright 的具体使用方法或深入功能,请参考其官方文档和相关资源。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client