0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Chrome DevTools MCPで探索的テストしてみた!

Last updated at Posted at 2025-10-02

はじめに

Chrome DevTools MCPを用いて探索的テストをするClaude Code スラッシュコマンドを作成してみました。

コマンドの内容

---
name: 探索的テスト
argument-hint: [url]
---

探索的テストを行い結果をユーザーにフィードバックします。

ユーザーから受けたコンテキストから以下を実行してください。

1. chrome-devtoolsを開始する
2. `$1`にアクセスする
3. 自律的にスクロールを行い、ページの内容を理解すること
4. 入力やクリックを行い、テストを行うこと
5. 常にコンソールエラーが出ていないか注視すること
6. テストが完了したらユーザーにフィードバックをする

Claude Codeのログ

入力内容:

> /test http://localhost:3000 
ログ
> /test is running… http://localhost:3000 

⏺ I'll help you perform exploratory testing on http://localhost:3000. Let me start by creating a todo list and then begin the testing process.

⏺ Now let me navigate to the page and check the console for any errors:
  ⎿  # list_pages response                                                                                                                    
     ## Pages
     0: about:blank [selected]

⏺ chrome-devtools - navigate_page (MCP)(url: "http://localhost:3000")
  ⎿  # navigate_page response                                                                                                                 
     ## Pages
     0: http://localhost:3000/ [selected]
  ⎿  # list_console_messages response                                                                                                         
     ## Console messages
     Log> node_modules_next_dist_client_8f19e6fb._.js:14974:16: [Fast Refresh] rebuilding [Fast Refresh] rebuilding

⏺ Good! The page loaded successfully with just a Fast Refresh message (normal for Next.js development). Now let me take a snapshot to
  understand the page content:
  ⎿  # take_snapshot response                                                                                                                 
     ## Page content
     uid=1_0 RootWebArea "補助金検索システム"
     … +186 lines (ctrl+o to expand)

⏺ Great! I can see this is a subsidy search system (補助金検索システム) with data from jGrants. Let me scroll down to see more content:

⏺ chrome-devtools - evaluate_script (MCP)(function: "() => {\n  window.scrollTo(0, document.body.scrollHeight / 2);\n  return { scrolled: true,
                                         scrollPosition: window.scrollY };\n}")
  ⎿  # evaluate_script response                                                                                                               
     Script ran on page and returned:
     ```json
     … +5 lines (ctrl+o to expand)
  ⎿  # take_snapshot response                                                                                                                                               
     ## Page content
     uid=2_0 RootWebArea "補助金検索システム"
     … +186 lines (ctrl+o to expand)
  ⎿  # list_console_messages response                                                                                                                                       
     ## Console messages
     Log> node_modules_next_dist_client_8f19e6fb._.js:14974:16: [Fast Refresh] rebuilding [Fast Refresh] rebuilding
     Log> node_modules_next_dist_client_8f19e6fb._.js:14838:12: [Fast Refresh] done in 334ms [Fast Refresh] done in 334ms

⏺ Good, no errors. Let me scroll to the bottom to see if there's more content:

⏺ chrome-devtools - evaluate_script (MCP)(function: "() => {\n  window.scrollTo(0, document.body.scrollHeight);\n  return { scrolled:
                                         true, scrollPosition: window.scrollY, totalHeight: document.body.scrollHeight };\n}")
  ⎿  # evaluate_script response                                                                                                     
     Script ran on page and returned:
     ```json
     … +6 lines (ctrl+o to expand)

⏺ Now let me test the search functionality by entering a keyword:

⏺ chrome-devtools - fill (MCP)(uid: "2_3", value: "環境")
  ⎿  # fill response                                                                                                                
     Successfully filled out the element
     ## Page content
     … +187 lines (ctrl+o to expand)

⏺ Good! Let me now click the search button and check for console errors:

⏺ chrome-devtools - click (MCP)(uid: "3_5")
  ⎿  # click response                                                                                                               
     Successfully clicked on the element
     ## Page content
     … +10 lines (ctrl+o to expand)
  ⎿  # list_console_messages response                                                                                               
     ## Console messages
     Log> node_modules_next_dist_client_8f19e6fb._.js:14974:16: [Fast Refresh] rebuilding [Fast Refresh] rebuilding
     Log> node_modules_next_dist_client_8f19e6fb._.js:14838:12: [Fast Refresh] done in 334ms [Fast Refresh] done in 334ms

⏺ Great! The button changed to "検索中..." (Searching...). Let me wait for the results to load:

⏺ chrome-devtools - wait_for (MCP)(text: "検索結果", timeout: 5000)
  ⎿  Error: Timed out after waiting 30000ms

⏺ Let me check the current page state and console:
  ⎿  # take_snapshot response                                                                                                       
     ## Page content
     uid=5_0 RootWebArea "補助金検索システム"
     … +149 lines (ctrl+o to expand)
  ⎿  # list_console_messages response                                                                                               
     ## Console messages
     Log> node_modules_next_dist_client_8f19e6fb._.js:14974:16: [Fast Refresh] rebuilding [Fast Refresh] rebuilding
     … +18 lines (ctrl+o to expand)

⏺ Excellent! The search worked and returned 1181 results. I noticed some Swiper Loop warnings. Let me continue testing by trying the
  filter toggles and pagination:

⏺ chrome-devtools - evaluate_script (MCP)(function: "() => {\n  window.scrollTo(0, 0);\n  return { scrolled: true };\n}")
  ⎿  # evaluate_script response                                                                                                     
     Script ran on page and returned:
     ```json
     … +4 lines (ctrl+o to expand)
  ⎿  # take_snapshot response                                                                                                       
     ## Page content
     uid=6_0 RootWebArea "補助金検索システム"
     … +149 lines (ctrl+o to expand)

⏺ Let me click on one of the subsidy items to see if details work, test pagination, and then test the clear button:

⏺ chrome-devtools - click (MCP)(uid: "6_10")
  ⎿  # click response                                                                                                               
     Successfully clicked on the element
     ## Page content
     … +6 lines (ctrl+o to expand)
  ⎿  # list_console_messages response                                                                                               
     ## Console messages
     Log> node_modules_next_dist_client_8f19e6fb._.js:14974:16: [Fast Refresh] rebuilding [Fast Refresh] rebuilding
     … +19 lines (ctrl+o to expand)

⏺ Let me wait for the page to load and take a snapshot:

⏺ chrome-devtools - evaluate_script (MCP)(function: "() => {\n  return new Promise(resolve => setTimeout(() => resolve({ waited: true }),
                                          2000));\n}")
  ⎿  # evaluate_script response                                                                                                     
     Script ran on page and returned:
     ```json
     … +4 lines (ctrl+o to expand)
  ⎿  # take_snapshot response                                                                                                       
     ## Page content
     uid=8_0 RootWebArea "補助金検索システム"
     … +63 lines (ctrl+o to expand)
  ⎿  # list_console_messages response                                                                                               
     ## Console messages
     Log> node_modules_next_dist_client_8f19e6fb._.js:14974:16: [Fast Refresh] rebuilding [Fast Refresh] rebuilding
     … +20 lines (ctrl+o to expand)

⏺ Perfect! The detail page loaded successfully. Let me go back and test the pagination:

⏺ chrome-devtools - click (MCP)(uid: "8_3")
  ⎿  # click response                                                                                                               
     Successfully clicked on the element
     ## Page content
     … +129 lines (ctrl+o to expand)

⏺ Good! Now let me test clicking the clear button and then test the home page navigation:

⏺ chrome-devtools - click (MCP)(uid: "9_4")
  ⎿  # click response                                                                                                               
     Successfully clicked on the element
     ## Page content
     … +165 lines (ctrl+o to expand)
  ⎿  # list_console_messages response                                                                                               
     ## Console messages
     Log> node_modules_next_dist_client_8f19e6fb._.js:14974:16: [Fast Refresh] rebuilding [Fast Refresh] rebuilding
     … +35 lines (ctrl+o to expand)

⏺ Great! The advanced filters panel opened. Now let me click the "条件をクリア" (Clear Conditions) button and then go back to home:

⏺ chrome-devtools - click (MCP)(uid: "10_22")
  ⎿  # click response                                                                                                               
     Successfully clicked on the element
     ## Page content
     … +150 lines (ctrl+o to expand)
  ⎿  # list_console_messages response                                                                                               
     ## Console messages
     Log> node_modules_next_dist_client_8f19e6fb._.js:14974:16: [Fast Refresh] rebuilding [Fast Refresh] rebuilding
     … +35 lines (ctrl+o to expand)

⏺ Perfect! Now let me click on the home title to go back to the home page:

⏺ chrome-devtools - click (MCP)(uid: "11_1")
  ⎿  # click response                                                                                                               
     Successfully clicked on the element
     ## Page content
     … +150 lines (ctrl+o to expand)
  ⎿  # list_console_messages response                                                                                               
     ## Console messages
     Log> node_modules_next_dist_client_8f19e6fb._.js:14974:16: [Fast Refresh] rebuilding [Fast Refresh] rebuilding
     … +35 lines (ctrl+o to expand)

⏺ Let me navigate back to home to complete testing and prepare the feedback:

⏺ chrome-devtools - navigate_page (MCP)(url: "http://localhost:3000")
  ⎿  # navigate_page response                                                                                                       
     ## Pages
     0: http://localhost:3000/ [selected]
  ⎿  # take_snapshot response                                                                                                       
     ## Page content
     uid=13_0 RootWebArea "補助金検索システム"
     … +186 lines (ctrl+o to expand)
  ⎿  # list_console_messages response                                                                                               
     ## Console messages
     <no console messages found>

⏺ テスト完了フィードバック

  ✅ 正常動作の確認

  基本機能
  - ホームページの表示: 正常
  - キーワード検索: 「環境」で検索 → 1181件の結果を正常に取得
  - 補助金詳細ページ: 遷移・表示が正常
  - 検索結果から戻る: 正常
  - フィルターパネルの開閉: 正常
  - 条件クリアボタン: 正常
  - ページネーション: 表示正常(119ページ)

  表示内容
  - 締切間近の補助金セクション: カルーセル表示正常
  - おすすめの補助金セクション: カルーセル表示正常
  - 補助金カード: 詳細情報(締切日、地域、金額、対象)が適切に表示

  ⚠️ 検出された問題

  Swiper Loop Warning(複数回発生)
  Swiper Loop Warning: The number of slides is not enough for loop mode,
  it will be disabled or not function properly. You need to add more slides
  (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters

  原因: カルーセルでループモードが有効だが、スライド数が不足

  推奨対応:
  1. スライド数が少ない場合はループモードを無効化
  2. または slidesPerView / slidesPerGroup の値を調整

  📊 総評

  - 機能面: すべての主要機能が正常に動作
  - エラー: コンソールエラーなし(警告のみ)
  - UX: スムーズな操作感、ローディング状態も適切
  - データ: jGrantsからのデータ取得が正常に機能

  アプリケーションは本番環境にデプロイ可能な状態ですが、Swiper警告の解消を推奨します。
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?