DevTools: Your Most Powerful Testing Tool
Browser DevTools is the single most valuable tool in a web tester’s arsenal. It lets you see everything happening under the surface — network requests, JavaScript errors, DOM changes, storage data, performance metrics, and more.
Every major browser includes DevTools: Chrome DevTools (F12), Firefox Developer Tools, Safari Web Inspector, and Edge DevTools. This lesson focuses on Chrome DevTools because it is the most widely used, but the concepts apply to all browsers.
Opening DevTools
There are multiple ways to open DevTools:
- F12 or Ctrl+Shift+I (Windows/Linux) / Cmd+Option+I (Mac)
- Right-click any element and select “Inspect”
- Chrome menu > More Tools > Developer Tools
Once open, you can dock DevTools to the bottom, right side, left side, or as a separate window. For testing, docking to the right side is often most practical because you can see the page and the tools simultaneously.
The Elements Tab
The Elements tab shows the live DOM tree and all CSS styles applied to each element.
Inspecting Elements
Right-click any element on the page and select “Inspect” to jump directly to it in the DOM tree. From here you can:
- View the HTML structure — see parent-child relationships, attributes, and text content
- Edit HTML live — double-click any attribute or text to modify it temporarily
- Delete elements — select and press Delete to remove elements and see how the page reflows
- Search the DOM — press Ctrl+F in the Elements panel to search by tag name, attribute, text, or CSS selector
Inspecting Styles
The Styles panel on the right shows all CSS rules applied to the selected element, in order of specificity. You can:
- Toggle properties — click the checkbox to disable/enable any CSS property
- Edit values — click any value to change it in real-time
- Add new properties — click in empty space within a rule to add new CSS
- See computed values — switch to the “Computed” tab to see final calculated values after all CSS rules are applied
- Force element states — click the
:hovbutton to toggle:hover,:active,:focus,:visitedstates
Box Model Visualization
At the bottom of the Styles panel (or in the Computed tab), you see a visual representation of the box model — content, padding, border, and margin with exact pixel values. This is essential for diagnosing layout bugs.
The Console Tab
The Console is where JavaScript errors appear and where you can execute JavaScript commands.
Reading Console Messages
Messages are color-coded:
- Red (Errors): JavaScript exceptions, failed network requests, security violations
- Yellow (Warnings): Deprecation notices, performance warnings, non-critical issues
- Blue (Info): Informational messages from the application
- Gray (Verbose): Detailed debugging messages
Every red error message is potentially a bug worth investigating.
Useful Console Commands for Testing
// Count all elements of a specific type
document.querySelectorAll('button').length
// Find elements by text content
[...document.querySelectorAll('*')].filter(el =>
el.textContent.includes('Search text')
)
// Check if an element is visible
const el = document.querySelector('.my-element');
const style = window.getComputedStyle(el);
console.log('Display:', style.display, 'Visibility:', style.visibility);
// Monitor events on an element
monitorEvents(document.querySelector('#myButton'), 'click');
// Take a full-page screenshot
// Ctrl+Shift+P > "Capture full size screenshot"
// Clear console
console.clear()
Console Filtering
Use the dropdown filters to show only Errors, Warnings, Info, or Verbose messages. You can also filter by text using the search box. When testing, start by filtering for Errors only — these are the highest priority.
The Network Tab
The Network tab is where you monitor all HTTP traffic between the browser and servers.
Understanding the Request List
Each row represents one HTTP request. Key columns:
- Name: The URL path or filename
- Status: HTTP status code (200, 404, 500, etc.)
- Type: Document, Script, Stylesheet, XHR/Fetch, Image, etc.
- Size: Transfer size and actual size
- Time: How long the request took
- Waterfall: Visual timeline of the request
Filtering Requests
Use the filter buttons to show specific request types:
- XHR/Fetch: API calls — this is where most backend bugs are visible
- JS: JavaScript files
- CSS: Stylesheet files
- Img: Images
- Doc: HTML documents
Inspecting a Request
Click any request to see its details:
- Headers: Request and response headers, including cookies, content type, and authentication tokens
- Payload: The data sent in POST/PUT requests (form data or JSON)
- Preview: A formatted view of the response (JSON rendered as a tree)
- Response: The raw response body
- Timing: Breakdown of DNS, connection, TLS, waiting, and download time
Network Throttling
The throttle dropdown lets you simulate slow connections. Test with:
- Fast 3G: Typical mobile connection
- Slow 3G: Poor mobile connection
- Offline: No connectivity at all
This reveals bugs that only appear under slow network conditions — loading spinners that never disappear, data races, timeout handling.
Preserving Logs
Check “Preserve log” to keep network requests across page navigations. This is critical for testing:
- Login flows (redirects clear the log by default)
- Form submissions that redirect
- Multi-step wizards
The Application Tab
The Application tab (called Storage in Firefox) reveals client-side data storage.
Cookies
View, edit, and delete cookies for the current domain. Key things to test:
- Session cookies: Do they expire when the browser closes?
- Persistent cookies: Is the expiration time reasonable?
- Secure flag: Are sensitive cookies marked as Secure (HTTPS only)?
- HttpOnly flag: Are authentication cookies HttpOnly (not accessible to JavaScript)?
- SameSite: Is the SameSite attribute set to prevent CSRF?
Local Storage and Session Storage
View key-value pairs stored in the browser:
- localStorage: Persists until explicitly cleared
- sessionStorage: Cleared when the tab closes
Test what happens when you manually delete storage items — does the application handle missing data gracefully?
Service Workers
If the application uses service workers (for offline support or push notifications), you can inspect them here. Test:
- Does the application work offline?
- Are cached resources updated when the server has new versions?
- Do push notifications arrive correctly?
The Performance Tab
Record a performance trace to analyze page load and runtime performance.
Recording a Trace
- Click the Record button (or Ctrl+E)
- Perform the action you want to measure
- Stop recording
The trace shows:
- Frames per second (FPS): Drops below 60 indicate jank
- CPU usage: Spikes indicate heavy processing
- Network requests: Timeline of all requests during the recording
- Main thread activity: JavaScript execution, layout, paint, and compositing
Testing Performance Scenarios
Use performance recording to test:
- Page load time: Record from initial navigation
- Scroll performance: Record while scrolling through long lists
- Animation smoothness: Record during CSS or JavaScript animations
- Form submission: Record the entire submit-to-response cycle
Advanced DevTools Techniques
Device Emulation
Press Ctrl+Shift+M to toggle device emulation. This lets you:
- Select specific device profiles (iPhone, Pixel, iPad)
- Set custom screen dimensions
- Simulate touch events
- Change device pixel ratio
- Emulate geolocation
- Simulate device orientation
Breakpoints in Sources Tab
While primarily for developers, knowing about breakpoints helps QA:
- DOM breakpoints: Right-click an element > “Break on” > subtree modifications, attribute modifications, or node removal. The debugger pauses when the DOM changes, helping you catch dynamic bugs.
- XHR breakpoints: In the Sources tab, add a breakpoint that triggers when a specific URL is fetched. Useful for debugging API call issues.
- Event listener breakpoints: Pause on specific event types (click, submit, keypress) to understand application behavior.
Exercise: Complete DevTools Investigation
Choose a web application and perform this investigation checklist:
- Elements tab: Find the main navigation. Is it using semantic
<nav>tags? Check all links for validhrefattributes. - Console tab: Note all error messages. For each error, determine if it is a real bug or a third-party script issue.
- Network tab: Filter by XHR/Fetch. Identify all API endpoints the page calls. Note any failed requests (4xx/5xx).
- Application tab: Check cookies for security flags (Secure, HttpOnly, SameSite). Check localStorage for any sensitive data that should not be there.
- Performance tab: Record a page load. Note the total load time and the largest content paint (LCP) time.
Document findings in a table:
| Tab | Finding | Severity | Bug? |
|---|---|---|---|
| Console | TypeError: Cannot read property ‘map’ of undefined | High | Yes |
| Network | GET /api/user returns 401 when logged in | High | Yes |
| Application | Auth token stored in localStorage (should be httpOnly cookie) | Medium | Yes (Security) |
Key Takeaways
- DevTools is the most powerful tool for web testing — learn it deeply
- The Elements tab reveals the live DOM and CSS; use it for visual bug investigation
- The Console shows JavaScript errors that users never see but that indicate real bugs
- The Network tab exposes all API communication — filter by XHR to focus on backend calls
- The Application tab reveals client-side storage; check cookies for security flags
- Device emulation lets you test responsive behavior without physical devices
- Preserve logs across page navigations when testing multi-step flows