Browser agents: test your site the way the agent sees it|INEMA.CLUB-PRO

Lesson 3 · 15 min

Chrome DevTools MCP: see what the agent did (console, network)

When the agent says "I couldn't do it," the answer is usually in the console or the network: a file that returned 404, a JavaScript error. Chrome DevTools MCP gives the agent the same tabs you open with F12. In this lesson you list the console and the network of the kit page, find the planted error, and bring it to zero.

Start the lesson
Dark monitor with the developer tools panel open, network and console rows, neutral light.

In this lesson you will

  1. 1list_console_messages and list_network_requests
  2. 2The planted error: a promocoes.json that returns 404
  3. 3Telemetry is on by default, and how to turn it off
  4. 4pageId, sandbox, and the other gotchas in 1.10.1

Goal: use Chrome DevTools MCP to see the console and network of the page the agent opened, find the error, and bring it to zero in a fixed copy.

01The agent's F12

Click each block.

Click each block in the diagram to see what it does.

The page looks right. The console and the network show that a file is missing.

02Playwright MCP or DevTools MCP?

One acts, the other investigates.

1. To act

Fill in, click, and wait using the accessibility tree, with refs. Playwright MCP also lists console and network (browser_console_messages, browser_network_requests), but its strength is the task.

03Find the error and bring it to zero

devtools.mjs opens the kit's home page and lists the console and network. The fix runs on a copy, without touching the kit.

Terminal · console and network of the kit page
cd ~/projetos/formacao-webmcp-navegador-v72/kit
node devtools.mjs; echo "saída: $?"
Terminal · fix in a copy and check
cd ~/projetos/formacao-webmcp-navegador-v72/kit
E=${TMPDIR:-/tmp}/kit3-aula3; rm -rf "$E"; cp -r site "$E"
echo '{"texto": "Revisão básica com 10% de desconto em novembro."}' > "$E/promocoes.json"
SITE="$E" node devtools.mjs; echo "saída: $?"
Example from the repository
→ navigate_page {"url":"http://127.0.0.1:PORTA/","pageId":1}
→ list_console_messages {"pageId":1}
  [error] Failed to load resource: the server responded with a status of 404 (Not Found)
  [error] promoções: falha ao carregar promocoes.json (HTTP 404)
→ list_network_requests {"pageId":1}
  GET http://127.0.0.1:PORTA/ [200]
  GET http://127.0.0.1:PORTA/estilo.css [200]
  GET http://127.0.0.1:PORTA/promocoes.json [404]
erros no console: 2 · requisições: 3 · com falha: 1
saída: 1

Two console errors (the browser's 404 and the page's own message) and one failed request. On screen, the page only says "Sem promoções no momento".

04Practice

The kit's error and your site. Each exercise has a "done when".

E1 · Find the 404

5 min

Run the first block. Open kit/site/index.html and find the line that asks for the missing file.

Done when: node devtools.mjs → erros no console: 2 · requisições: 3 · com falha: 1 and saída: 1.

E2 · Bring it to zero on the copy

10 min

Run the second block. Then change the text in the copy's promocoes.json and check that the page shows the new text.

Done when: the second block (SITE="$E" node devtools.mjs, with E=/tmp/kit3-aula3) → erros no console: 0 · requisições: 3 · com falha: 0 and saída: 0.

E3 · Your site's console

10 min

Run devtools.mjs with the address of one of your sites. For each error, note whether an agent would lose anything because of it.

Done when: node devtools.mjs with your site's address → line erros no console: N · requisições: M · com falha: F, with N and F written down.

05Lesson quiz

Question 1 of 4

The page shows "Sem promoções no momento" and looks normal. Where does the agent find out something broke?skill

06In three sentences

Console and networkWhat the screen hides, list_console_messages and list_network_requests show.
Telemetry offVersion 1.10.1 sends usage data to Google by default; the kit turns it off.
One acts, one investigatesPlaywright MCP for the task, DevTools MCP for the why.

Going further

Previous lessonNext lesson