title: Puppeteer cannot breakpoint inside page.evaluate or page.$$eval
body: <p>Using Puppeteer version: &quot;9.0.0&quot;</p>
  <p>Unfortunately debugging in chrome dev tools does not work at all with this puppeteer version.
  So I resorted to <a href="https://www.npmjs.com/package/ndb" rel="nofollow noreferrer">NDB</a>.
  Using NDB I can breakpoint anywhere apart from inside page.evaluate function and page.$$eval().</p>
  <p>Running the script with ndb:</p>
  <pre><code>&quot;scripts&quot;: {
  &quot;test&quot;: &quot;echo \&quot;Error: no test specified\&quot; &amp;&amp; exit 1&quot;,
  &quot;start&quot;: &quot;ndb node startscrape.js&quot;
   },
  </code></pre>
  <p>startscrape.js</p>
  <pre><code>( async () =&gt; {
  
  
  
  const browser = await puppeteer.launch(
      {
         
          headless: false,
          defaultViewport:null,
          slowMo: 250,
          devtools:true,
         
      });
  
  
          
  
  const page = await browser.newPage();
  
  await page.goto('https://www.google.com');
  await page.type('input', 'Here' );
  await page.keyboard.press('Enter');
  await page.waitForNavigation();
  
  
  let x = () =&gt; {
       debugger;
        console.log('can I debug here?') //YES - breakpoints work upon executing x();
  
   };
  
   x();
  
  
  let xa = await page.evaluate(() =&gt; {
      console.log('Alive'); // Logging works in console but cannot breakpoint
      let elements = document.getElementsByClassName('someitem');
      return elements;
  });
  
      // Cannot debug inside here too
  // let xa = await page.$$eval('body', (body) =&gt; {
  //     console.log('Alive');
  //     let elements = document.getElementsByClassName('serp-item');
  //     return elements;
  // });
  
  
  // breakpoint comes here 
  await page.goto('https://www.google.com');
  
  
  //await browser.waitForTarget(() =&gt; false);
  
    })();
  </code></pre>
  <p><a href="https://i.stack.imgur.com/bi8Gu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bi8Gu.png" alt="enter image description here" /></a></p>