Community程式設計與開發github.com

microsoft/playwright-cli

自動化瀏覽器操作、測試網頁並處理 Playwright 測試。

playwright-cli 是什麼?

此技能利用 Microsoft 的 Playwright CLI 來自動化瀏覽器操作,讓開發者能夠在真實的瀏覽器環境中執行端對端測試、網頁擷取及表單填寫等任務。它支援 Chromium、Firefox 和 WebKit 等多種瀏覽器引擎,並透過 npx playwright 指令來啟動測試或腳本。開發者可以透過此技能快速建立可靠的瀏覽器自動化流程,適用於 CI/CD 管線、回歸測試及資料收集。其核心優勢在於跨瀏覽器相容性與非同步事件處理能力,確保測試結果的穩定性。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/microsoft/playwright-cli/tree/main/skills/playwright-cli

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

playwright-cli 是做什麼的?

自動化瀏覽器操作、測試網頁並處理 Playwright 測試。

概觀

此技能讓開發者能夠使用 Microsoft 的 Playwright CLI 工具來自動化瀏覽器互動。支援多種瀏覽器(Chromium、Firefox、WebKit),可用於端對端測試、網頁擷取、表單填寫及螢幕截圖。

常用指令

  • npx playwright test — 執行所有測試
  • npx playwright test --headed — 以可見視窗執行測試
  • npx playwright show-report — 檢視測試報告
  • npx playwright codegen — 記錄使用者操作並產生測試程式碼

使用範例

執行單一測試檔案

npx playwright test tests/example.spec.ts

安裝瀏覽器

npx playwright install

使用 codegen 記錄操作

npx playwright codegen https://example.com

設定

專案需要包含 playwright.config.ts(或 playwright.config.js)設定檔,並在 package.json 中安裝 @playwright/test。

{
  "devDependencies": {
    "@playwright/test": "^1.40.0"
  },
  "scripts": {
    "test": "playwright test"
  }
}

相關資源

Individual skills in this repo

This repo contains 1 individual skill — each has its own dedicated page.

相關技能