tips
22 tips Devtools
One command, setting or habit at a time about Devtools: what it does, the line to copy and a caveat or two.
Web development 21
-
Wipes storage and cache for the current site only, leaving other sites alone.
-
Pauses the debugger on a line only when your condition is true.
user.id === 42 -
Finds page elements with an XPath expression and returns them as an array.
$x(path [, startNode]) -
Switches the page between light and dark styling from inside DevTools.
@media (prefers-color-scheme: dark) { -
Count the live objects of one type while hunting a memory leak.
queryObjects(Promise) -
Open the Elements panel on exactly the node your selector returns.
inspect(document.querySelector('footer')) -
Watch a value update by itself instead of typing it again and again.
Console > Create Live Expression -
Test location based features as if you were somewhere else.
type "sensors" > Show Sensors > Geolocation -
Check what a server or script sends when the browser claims to be different.
User agent > untick "Use browser default" -
Find animations and widgets that redraw far more than they need to.
Show Rendering > Paint flashing -
Get a tidy picture of a single card or table without cropping by hand.
right-click the node > Capture node screenshot -
Turn something you found by clicking into a variable you can script.
right-click the node > Store as global variable -
Prints a message to the Console each time a line runs, without pausing the page.
'cart total', total, items.length -
Copies the result of a console expression to the clipboard as text.
copy($$('a').map(a => a.href)) -
Edits an HTTP response header in Chrome so you can test a fix before changing the server.
-
Saves the network log as a HAR file without cookie and authorization headers.
-
Saves JavaScript in DevTools so you can run it on any page with one shortcut.
console.table([...document.querySelectorAll('img')].map(i => i.src)) -
Keeps an element in its hover state so you can edit the matching CSS.
Elements > Styles > :hov > :hover -
Pauses the debugger on the line that sends a request whose URL contains your text.
/api/orders -
Finds a piece of text in every file the page has loaded, from one search box.
Ctrl+Shift+F > Authorization -
Opens a searchable command menu in Chrome DevTools, for example for full-page screenshots.
HTTP and nginx 1
-
Stop old CSS and scripts from confusing you while you work on a site.
Network panel > Disable cache
Nothing in this filter yet.