Must-Know Chrome DevTools Tips and Tricks



Awesome Tips about Chrome Series

DevTools Keyboard Shortcuts

Ctrl+Option+IOpen whatever panel you used last
Ctrl+[(or ])Focus the previous(next) panel
Ctrl+Shift+PRun command

Ctrl+Shift+P to Run command

  • Capture screenshot, Capture area screenshot: useful when your company blocks Chrome screenshot extension.

Inject CSS

  • At console: document.head.insertAdjacentHTML('beforeend','<style></style>');

Network Tab

Sources Tab

  • Ctrl+Shift+F to search source code
  • Pretty print {}
  • Find loaded content scripts at source tab
  • Set XHR/fetch breakpoints to check who sends the request
  • Add breakpoints at source code
  • Trigger a breakpoint when an exception occurs
  • Add Conditional breakpoints
  • Add Event breakpoints
  • Add debugger; in the code to trigger programmatic breakpoints
  • Add an expression to the watch list
  • Add debug snippets
Shortcuts in the Sources panel:
ctrl+oshow all the files loaded by the page.
ctrl+shift+oshow the symbols(properties,functions,classes) in the current file.
ctrl+ggo to a specific line

Elements tab

  • Break on -> subtree modifications
  • Edit as HTML
  • Drag and Drop any HTML element
  • Scroll into view
  • Force state
  • ctrl-click a CSS property to find where it’s defined.
  • Copy XPath or selector from Elements panel
  • Alt+Click the arrow to expand all child nodes.

Console tab

  • Preserve log on navigation
    • At the console tab, click the settings icon on the top right: Console: Preserve log on navigation
  • document.designMode = 'on' to change anything in the page
  • $0 in console refers to the currently selected node
  • $(css_selector): document.querySelector()
  • $$(css_selector): document.querySelectorAll()
  • $_ to reference the return value of the previous operation executed
  • shift+enter to span command in multiple lines
  • ctrl+l(cmd+k on Mac) to clear console

Other Chrome DevTools Tips

  • Check Enable Ctrl + 1-9 shortcut to switch panels at DevTools Settings -> Appearance
  • Change DevTools position

Labels

adsense (5) Algorithm (69) Algorithm Series (35) Android (7) ANT (6) bat (8) Big Data (7) Blogger (14) Bugs (6) Cache (5) Chrome (19) Code Example (29) Code Quality (7) Coding Skills (5) Database (7) Debug (16) Design (5) Dev Tips (63) Eclipse (32) Git (5) Google (33) Guava (7) How to (9) Http Client (8) IDE (7) Interview (88) J2EE (13) J2SE (49) Java (186) JavaScript (27) JSON (7) Learning code (9) Lesson Learned (6) Linux (26) Lucene-Solr (112) Mac (10) Maven (8) Network (9) Nutch2 (18) Performance (9) PowerShell (11) Problem Solving (11) Programmer Skills (6) regex (5) Scala (6) Security (9) Soft Skills (38) Spring (22) System Design (11) Testing (7) Text Mining (14) Tips (17) Tools (24) Troubleshooting (29) UIMA (9) Web Development (19) Windows (21) xml (5)