Your most important tool
Browser DevTools is where you’ll spend a significant chunk of your development time. It lets you inspect the DOM, run JavaScript, monitor network requests, and debug errors — all without leaving the browser.Opening DevTools
- Chrome / Edge
- Firefox
- Safari
| Action | Shortcut |
|---|---|
| Open DevTools | F12 or Ctrl+Shift+I (Windows) / Cmd+Option+I (Mac) |
| Open Console directly | Ctrl+Shift+J (Windows) / Cmd+Option+J (Mac) |
| Inspect element | Ctrl+Shift+C (Windows) / Cmd+Option+C (Mac) |
Elements panel
The Elements panel shows the live DOM tree. You can inspect, edit, and experiment with any element on the page.What you can do
Practical uses
- Debug layout issues: Inspect an element, check its computed size, margin, and padding
- Test style changes: Edit CSS values live — no need to save and reload
- Find elements: Use
Ctrl+F/Cmd+Fin the Elements panel to search by text, selector, or XPath - Check accessibility: See element roles, ARIA attributes, and contrast ratios
Changes you make in the Elements panel are temporary — they disappear when you refresh the page. This makes it safe to experiment without fear of breaking anything.
Console panel
The Console is where you’ll run JavaScript interactively, see errors, and debug your code.Running JavaScript
Console methods
| Method | Purpose |
|---|---|
console.log() | General output |
console.error() | Red error message |
console.warn() | Yellow warning |
console.table() | Display arrays/objects as a table |
console.group() / console.groupEnd() | Group related logs |
console.time() / console.timeEnd() | Measure execution time |
console.clear() | Clear the console |
Reading error messages
When your code breaks, the console shows the error with a clickable file and line number:- What: Tried to read
.textContenton something that’snull - Where:
script.js, line 15, column 23 - Why: Probably tried to select an element that doesn’t exist (yet)
Network panel
The Network panel shows every HTTP request the page makes — HTML, CSS, JavaScript, images, and API calls. This is essential for debugging your FastAPI integration.What to look for
- Status codes: 200 (success), 404 (not found), 500 (server error), CORS errors
- Request/response bodies: Click a request to see what was sent and received
- Timing: How long each request takes
- Headers: Check Content-Type, Authorization, CORS headers
Filtering API calls
Click the Fetch/XHR filter to show only API calls (hides images, CSS, etc.). This is the view you’ll use most when debugging your frontend-backend communication.Application panel
The Application panel lets you inspect browser storage:- localStorage: Key-value pairs persisted between sessions
- sessionStorage: Key-value pairs cleared when the tab closes
- Cookies: Data sent with every request to the server
DevTools workflow for debugging
When something isn’t working, follow this order:Check the Console
Look for red error messages. They usually tell you exactly what’s wrong and where.
Inspect the element
Right-click the broken element → Inspect. Check if it exists, has the right classes, and has the expected content.
Check the Network panel
If data isn’t showing up, check if the API request succeeded. Look at the status code and response body.
What’s next?
You know how to inspect the DOM. Now let’s learn how to find specific elements in it with JavaScript.Selecting elements
Find and target HTML elements on the page