4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PlaywrightMCPをVSCode + Copilotで使う[初期設定〜ざっくり使い方まで]

Posted at

会社負担でCopilotがVSCodeで使える環境の人も多いと思うので、その環境下でPlaywrightMCPを使う方法をここに残しておこうと思います。

インストール

npx @playwright/mcp@latest

vscodeのsetting.jsonに追加

コマンドパレットでsetting.jsonを検索するなどして開いて、以下を書き込みました。

setting.json
{
//他の設定の後に・・・

    "mcpServers": {
        "playwright": {
            "command": "npx",
            "args": ["@playwright/mcp@latest"]
        }
    },
    "chat.agent.enabled": true
}

私は毎回@playwright/mcpとvscodeのターミナルに打ち込みたくないので、ここで常にMCPサーバを起動する設定にしましたが重いのが嫌な人はchat.agent.enabledをfalseにするといいかもしれないです。
また、setting.jsonでグレーアウトされているので不安になりますが気にしなくてOKです。

この後、copilotのchatで@mcpをつけて質問すると、MCPサーバ経由で回答してくれます。
copilotのchat画面でAgentに切り替えるように書いてある記事が多かったんですが、仕様の変更なのか、そんなことをしなくても接頭語に@mcpをつけて質問するだけで、見ているファイルへのPlaywrightを使ったテスト方法を教えてくれました。

以下参考にした記事です。

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?