I hate having to repeatedly press "step forward" in Chrome's Javascript debugger. I've had skip forward at least 100 times on this one script I am working on. How can I make it step forward any number of times I want it to before it pauses execution once more?
            Asked
            
        
        
            Active
            
        
            Viewed 353 times
        
    2 Answers
2
            
            
        Have you tried setting a breakpoint?
https://developers.google.com/web/tools/chrome-devtools/debug/breakpoints/add-breakpoints?hl=en
        Dror
        
- 7,255
 - 3
 - 38
 - 44
 
- 
                    1No, because I need to find the correct place first, which is why I need to step forward N times. – Melab Jun 29 '16 at 00:54
 - 
                    Not sure what the scenario you are trying to debug but conditional breakpoint should allow you to set it to the point you want to stop. – Dror Jun 29 '16 at 01:56
 
0
            
            
        As Dror mentioned, there are probably better ways to go about this.
However, if you really need the step forward functionality...
DevTools is a web app that you can inspect like any other page. Open the inspector and then paste this code in the console:
var times = 4;
step()
function step(){
   var btn = document.querySelector(".scripts-debug-toolbar").shadowRoot.querySelector(".step-over-toolbar-item");
    var enabled = !btn.parentNode.disabled
   if (enabled ){
     btn.dispatchEvent(new MouseEvent("click", {bubbles: true}));
     times--;
     if (times === 0){return}
     setTimeout(step, 1)
   } else {console.log("disabled");  setTimeout(step, 1) }
}
This will click on the "step over" button as many times as defined in the times varible.
        Community
        
- 1
 - 1
 
        Matt Zeunert
        
- 16,075
 - 6
 - 52
 - 78