We really appreciate the hard work those people put in to providing high quality TypeScript definitions for Puppeteer's users. Npm install -save-dev types that you'll see appearing in the Puppeteer source code are based off the great work of those who have contributed to the package. If you are on a version older than 7, we recommend installing the Puppeteer type definitions from the DefinitelyTyped repository: We have recently completed a migration to move the Puppeteer source code from JavaScript to TypeScript and as of version 7.0.1 we ship our own built-in type definitions. ![]() Ndb jest or ndb mocha (or npx ndb jest / npx ndb mocha)ĭebug your test inside chromium like a boss! Npm install -g ndb (or even better, use npx!)Īdd a debugger to your Puppeteer (node) codeĪdd ndb (or npx ndb) before your test command. This example filters out all Network domain messagesĮnv DEBUG="puppeteer:*" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '"Network'ĭebug your Puppeteer (node) code easily, using ndb Will be logged via the debug module under the puppeteer namespace. ![]() Now your debugger will be hit and you can debug in the test browserĮnable verbose logging - internal DevTools protocol traffic In the newly opened test browser, type F8 to resume test execution In Chrome open chrome://inspect/#devices and click inspect Run node -inspect-brk, eg node -inspect-brk node_modules/.bin/jest tests
0 Comments
Leave a Reply. |