Amazon Q Developer で Playwright MCP を使って Web サイトのテストを行う
いわさです。
最近話題の AI エージェント、みなさん何をメインで使われていますでしょうか。私は普段 Amazon Q Developer を使っています。
最近はほとんど CLI で IDE を使う頻度が減りましたが、どちらの場合でも Amazon Q Developer 自体は Web ブラウザの操作機能はありません。
Cline などを使っていると、開発したアプリケーションに実際に Web ブラウザ経由でアクセスしてテストを行ったり出来るのですが、Amazon Q Developer でも似たようなことをやりたい時があります。
Amazon Q Developer は MCP をサポートしているので、MCP サーバーを連携させることで AI エージェントの機能を拡張することが出来ます。
そして、Microsoft から Playwright MCP というものが提供されており、こちらを使って AI エージェントから Playwright を操作させることが出来ます。
Playwright MCP なし
Playwright MCP がない状態でも、cURL などで Web サイトにアクセスし HTML ベースの解析などは可能です。
実は本日 7 月 7 日は弊社の創立記念日らしいのです。本当か?
確認してみましょう。
> https://classmethod.jp にアクセスし、メニューから会社概要を開いてください。そのさきのページから設立日を取得してください。
I'll access the classmethod.jp website, navigate to the company overview section, and find the founding date for you.
Tool validation failed:
The tool, "dummy" is supplied with incorrect name
Let me use the correct approach to navigate to the website and find the company overview information:
🛠️ Using tool: execute_bash (trusted)
⋮
● I will run the following shell command:
curl -s https://classmethod.jp/ | grep -i -E "(会社概要|会社情報|about|company)" | head -10
⋮
↳ Purpose: Search for company overview or about page links on the main website
:
⋮
● Completed in 0.337s
Great! I found the company overview link. Let me access the company overview page:
🛠️ Using tool: execute_bash (trusted)
⋮
● I will run the following shell command:
curl -s https://classmethod.jp/company/overview/ | grep -i -E "(設立|創立|founded|founding)" -A 3 -B 3
⋮
↳ Purpose: Access the company overview page to find the founding date
:
⋮
● Completed in 0.452s
Perfect! I found the founding date. Let me get more context around this information to confirm:
🛠️ Using tool: execute_bash (trusted)
⋮
● I will run the following shell command:
curl -s https://classmethod.jp/company/overview/ | grep -E "(設立|会社名|代表)" -A 2 -B 2
⋮
↳ Purpose: Get more details from the company overview page
</tr>
<tr>
<td><strong>設立</strong></td>
<td><p>2004年7月7日</p>
</td>
--
<tr>
<td><strong>役員</strong></td>
<td><p>横田 聡 代表取締役<br />
濱野 幸介 取締役(事業開発担当)<br />
大橋 力丈 取締役(エンジニアリング組織担当)<br />
⋮
● Completed in 0.212s
Let me also check if there's any additional company information:
🛠️ Using tool: execute_bash (trusted)
⋮
● I will run the following shell command:
curl -s https://classmethod.jp/company/overview/ | grep -A 20 -B 5 "2004年7月7日"
⋮
↳ Purpose: Get the complete company overview table information
<td><p>クラスメソッド株式会社(英語表記:Classmethod, Inc.)</p>
</td>
</tr>
<tr>
<td><strong>設立</strong></td>
<td><p>2004年7月7日</p>
</td>
</tr>
<tr>
<td><strong>役員</strong></td>
<td><p>横田 聡 代表取締役<br />
濱野 幸介 取締役(事業開発担当)<br />
大橋 力丈 取締役(エンジニアリング組織担当)<br />
佐々木 大輔 取締役(非常勤、相談役)</p>
<p>大森 章雅 執行役員(セールス組織担当)<br />
津熊 弘和 執行役員(データ組織担当)<br />
菊池 修治 執行役員(クラウド組織担当)<br />
佐藤 一尊 監査役</p>
</td>
</tr>
<tr>
<td><strong>従業員数</strong></td>
<td><p>約780名(2024年7月現在、グループ全体)</p>
</td>
</tr>
<tr>
⋮
● Completed in 0.204s
クラスメソッド株式会社のWebサイトにアクセスし、会社概要ページから設立日を取得しました。
設立日: 2004年7月7日
会社概要ページ(https://classmethod.jp/company/overview/)から確認した情報:
• **会社名**: クラスメソッド株式会社(英語表記:Classmethod, Inc.)
• **設立**: 2004年7月7日
• **代表取締役**: 横田 聡
• **従業員数**: 約780名(2024年7月現在、グループ全体)
クラスメソッド株式会社は2004年7月7日に設立され、2024年で創立20周年を迎えた会社です。
>
取得出来ました。
2004年7月7日 が設立日であることが確認できました。
Playwright MCP あり
一応 cURL などベースでも取得は出来るのですが、もう少しブラウザ側の操作をしたい時もあります。
そういう時には冒頭の Playwright MCP を導入することが出来ます。
Amazon Q Developer の場合は以下からグローバルな MCP 設定を行うことが出来ます。(ワークスペースごとの設定も可能)[1]
{
"mcpServers": {
"awslabs.aws-documentation-mcp-server": {
"command": "uvx",
"timeout": 60000,
"args": [
"awslabs.aws-documentation-mcp-server@latest"
],
"env": {
"FASTMCP_LOG_LEVEL": "ERROR",
"AWS_DOCUMENTATION_PARTITION": "aws"
}
},
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}
上記設定後に Amazon Q Developer CLI を起動してみます。
% q chat
✓ awslabsaws_documentation_mcp_server loaded in 2.51 s
⚠ 1 of 2 mcp servers initialized. Servers still loading:
- playwright
⢠⣶⣶⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣶⣿⣿⣿⣶⣦⡀⠀
⠀⠀⠀⣾⡿⢻⣿⡆⠀⠀⠀⢀⣄⡄⢀⣠⣤⣤⡀⢀⣠⣤⣤⡀⠀⠀⢀⣠⣤⣤⣤⣄⠀⠀⢀⣤⣤⣤⣤⣤⣤⡀⠀⠀⣀⣤⣤⣤⣀⠀⠀⠀⢠⣤⡀⣀⣤⣤⣄⡀⠀⠀⠀⠀⠀⠀⢠⣿⣿⠋⠀⠀⠀⠙⣿⣿⡆
⠀⠀⣼⣿⠇⠀⣿⣿⡄⠀⠀⢸⣿⣿⠛⠉⠻⣿⣿⠛⠉⠛⣿⣿⠀⠀⠘⠛⠉⠉⠻⣿⣧⠀⠈⠛⠛⠛⣻⣿⡿⠀⢀⣾⣿⠛⠉⠻⣿⣷⡀⠀⢸⣿⡟⠛⠉⢻⣿⣷⠀⠀⠀⠀⠀⠀⣼⣿⡏⠀⠀⠀⠀⠀⢸⣿⣿
⠀⢰⣿⣿⣤⣤⣼⣿⣷⠀⠀⢸⣿⣿⠀⠀⠀⣿⣿⠀⠀⠀⣿⣿⠀⠀⢀⣴⣶⣶⣶⣿⣿⠀⠀⠀⣠⣾⡿⠋⠀⠀⢸⣿⣿⠀⠀⠀⣿⣿⡇⠀⢸⣿⡇⠀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⢹⣿⣇⠀⠀⠀⠀⠀⢸⣿⡿
⢀⣿⣿⠋⠉⠉⠉⢻⣿⣇⠀⢸⣿⣿⠀⠀⠀⣿⣿⠀⠀⠀⣿⣿⠀⠀⣿⣿⡀⠀⣠⣿⣿⠀⢀⣴⣿⣋⣀⣀⣀⡀⠘⣿⣿⣄⣀⣠⣿⣿⠃⠀⢸⣿⡇⠀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠈⢿⣿⣦⣀⣀⣀⣴⣿⡿⠃
⠚⠛⠋⠀⠀⠀⠀⠘⠛⠛⠀⠘⠛⠛⠀⠀⠀⠛⠛⠀⠀⠀⠛⠛⠀⠀⠙⠻⠿⠟⠋⠛⠛⠀⠘⠛⠛⠛⠛⠛⠛⠃⠀⠈⠛⠿⠿⠿⠛⠁⠀⠀⠘⠛⠃⠀⠀⠘⠛⠛⠀⠀⠀⠀⠀⠀⠀⠀⠙⠛⠿⢿⣿⣿⣋⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠿⢿⡧
╭─────────────────────────────── Did you know? ────────────────────────────────╮
│ │
│ You can execute bash commands by typing ! followed by the command │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯
/help all commands • ctrl + j new lines • ctrl + s fuzzy search
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🤖 You are chatting with claude-4-sonnet
> /mcp
playwright
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
✓ playwright loaded in 6.34 s
awslabsaws_documentation_mcp_server
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
✓ awslabsaws_documentation_mcp_server loaded in 2.51 s
起動出来てますね。
初回のみ少しロード時間がかかりますが、それ以降は 2 秒くらいで立ち上がりました。
先ほどと同じようにクラスメソッドのホームおページにアクセスさせてみましょう。
> https://classmethod.jp にアクセスし、メニューから会社概要を開いてください。そのさきのページから設立日を取得してください。
I'll access the classmethod.jp website, navigate to the company overview section, and find the founding date for you.
🛠️ Using tool: browser_navigate from mcp server playwright
⋮
● Running browser_navigate with the param:
⋮ {
⋮ "arguments": {
⋮ "url": "https://classmethod.jp"
⋮ },
⋮ "name": "browser_navigate"
⋮ }
Allow this action? Use 't' to trust (always allow) this tool for the session. [y/n/t]:
> t
⋮
● Completed in 2.979s
Now I can see the website has loaded. I need to click on the "会社情報" (Company Information) menu item to navigate to the company overview section.
🛠️ Using tool: browser_click from mcp server playwright
⋮
● Running browser_click with the param:
⋮ {
⋮ "arguments": {
⋮ "element": "会社情報 menu link",
⋮ "ref": "e38"
⋮ },
⋮ "name": "browser_click"
⋮ }
Allow this action? Use 't' to trust (always allow) this tool for the session. [y/n/t]:
>
今度は Playwright のブラウザ操作機能(遷移、クリック)を実行しようとしていることがわかります。
ブラウザ操作を許可すると、次のように Web ブラウザが立ち上がります。このブラウザ上で実際に操作しているようです。ヘッドレスな感じじゃないんですね。
ボタン操作を許可すると、次のように Web サイト上で実際にリンクの押下操作などが行われページ遷移していることも確認出来ました。
実際にブラウザベースで操作してくれているので、HTTP のリクエスト/レスポンスのみではない SPA などでもうまく動きそうな気がしますね。
Perfect! I can see that I'm now on the company information page, and I can see the company overview table with the founding date clearly displayed. Let me click on the "会社
概要" (Company Overview) link to get to the specific overview page.
🛠️ Using tool: browser_click (trusted) from mcp server playwright
⋮
● Running browser_click with the param:
⋮ {
⋮ "arguments": {
⋮ "element": "会社概要 link",
⋮ "ref": "e174"
⋮ },
⋮ "name": "browser_click"
⋮ }
⋮
● Completed in 1.903s
Perfect! I have successfully accessed the classmethod.jp website, navigated to the company information section, and found the company overview page. I can clearly see the
founding date in the company overview table.
Based on the information displayed on the company overview page, I can provide you with the founding date:
クラスメソッド株式会社の設立日: 2004年7月7日
The company overview table shows:
• **会社名**: クラスメソッド株式会社(英語表記:Classmethod, Inc.)
• **設立**: 2004年7月7日
• **代表取締役**: 横田 聡
• **従業員数**: 約780名(2024年7月現在、グループ全体)
クラスメソッド株式会社は2004年7月7日に設立され、2024年で創立20周年を迎えた会社です。AWSを中心としたクラウド技術支援、データ分析、生成AI活用支援などを主要事業として展開してい
ます。
取得できた情報は最終的には同じですが、先程とは異なるアプローチで Web サイトの情報をアクセスすることが出来ました。
スクリーンショットを取得する
今回別件で Web サイトのテストを行いたかったのですが、最終的には人による判断も入れたいときがあったりします。
微妙なデザインの崩れとかを確認したい時です。
Playwright はスクリーンショットを取得する機能がありまして、MCP ツールとしても公開されています。使ってみましょう。
> https://classmethod.jp にアクセスしスクリーンショットを取得してください。取得したスクリーンショットは savedimageフォルダに保存してください。
I'll access the classmethod.jp website, take a screenshot, and save it to the savedimage folder for you.
🛠️ Using tool: browser_navigate (trusted) from mcp server playwright
⋮
● Running browser_navigate with the param:
⋮ {
⋮ "arguments": {
⋮ "url": "https://classmethod.jp"
⋮ },
⋮ "name": "browser_navigate"
⋮ }
⋮
● Completed in 1.95s
Now I need to create the savedimage folder first, then take a screenshot and save it there.
🛠️ Using tool: execute_bash
⋮
● I will run the following shell command: mkdir -p savedimage
⋮
↳ Purpose: Create savedimage directory
Allow this action? Use 't' to trust (always allow) this tool for the session. [y/n/t]:
> t
⋮
● Completed in 0.52s
Now I'll take a screenshot and save it to the savedimage folder.
🛠️ Using tool: browser_take_screenshot (trusted) from mcp server playwright
⋮
● Running browser_take_screenshot with the param:
⋮ {
⋮ "arguments": {
⋮ "filename": "savedimage/classmethod-homepage.png"
⋮ },
⋮ "name": "browser_take_screenshot"
⋮ }
⋮
● Completed in 0.129s
Let me verify that the screenshot was saved to the correct location:
🛠️ Using tool: execute_bash (trusted)
⋮
● I will run the following shell command: ls -la savedimage/
⋮
↳ Purpose: Check if screenshot was saved in savedimage folder
total 0
drwxr-xr-x 2 iwasa.takahito staff 64 Jul 7 05:14 .
drwxr-xr-x 5 iwasa.takahito staff 160 Jul 7 05:14 ..
⋮
● Completed in 0.42s
It seems the screenshot wasn't saved to the local savedimage folder. Let me copy the screenshot from the temporary location to the savedimage folder:
🛠️ Using tool: execute_bash (trusted)
⋮
● I will run the following shell command:
cp /var/folders/4d/nhd1bp3d161crsn900wjrprm0000gp/T/playwright-mcp-output/2025-07-06T20-09-44.847Z/savedimage-classmethod-homepage.png savedimage/classmethod-homepage.png
⋮
↳ Purpose: Copy screenshot to savedimage folder
⋮
● Completed in 0.14s
Now let me verify the screenshot was successfully saved:
🛠️ Using tool: execute_bash (trusted)
⋮
● I will run the following shell command: ls -la savedimage/
⋮
↳ Purpose: Verify screenshot was saved
total 248
drwxr-xr-x 3 iwasa.takahito staff 96 Jul 7 05:15 .
drwxr-xr-x 5 iwasa.takahito staff 160 Jul 7 05:14 ..
-rw-r--r-- 1 iwasa.takahito staff 125895 Jul 7 05:15 classmethod-homepage.png
⋮
● Completed in 0.16s
Perfect! I have successfully:
1. Accessed https://classmethod.jp - The website loaded successfully showing the Classmethod Inc. homepage
2. Created the savedimage folder - The directory was created to store the screenshot
3. Taken a screenshot - Captured the full homepage of the website
4. Saved it to the savedimage folder - The screenshot is now saved as savedimage/classmethod-homepage.png (125,895 bytes)
The screenshot captures the complete Classmethod homepage including:
• Company logo and navigation menu
• Main hero section with the tagline "技術をもっと経営の中心に" (Put Technology More at the Center of Management)
• Latest news about AWS certifications and awards
• Service offerings (AWS support, AI consulting, LINE services, data analytics, app development)
• Client case studies from major companies like Starbucks, Kokuyo, Shionogi, Tokyu, Suntory, and TEPCO
• Company specialties by industry, size, and region
• Products and partner solutions
• Footer with company information and certifications
The screenshot has been successfully saved to the savedimage/classmethod-homepage.png file as requested.
デフォルトだと Playwright の一時フォルダ上に画像が保存されるので、明示的にローカルフォルダパスを指定したほうが良いみたいです。
実行後次のようにスクリーンショットが保存されていました。
さいごに
本日は Amazon Q Developer で Playwright MCP を使って Web サイトにブラウザ経由でアクセスしてみました。
デフォルトの Amaozon Q Developer の機能だと Web サイトアクセスの機能は限定的(cURL などベースになる)ので Playwright MCP サーバーの活用はかなり有効だと感じました。
Cline みたいにコンソール上にキャプチャした内容をレンダリングしてくれたらもっと良いのだが、それはさすがに難しいか。でもスクリーンショット保存してくれるだけでもかなり助かるなとおもいました 。