{"id":22308756,"url":"https://github.com/ratson/puppeteer_deno","last_synced_at":"2025-07-14T15:06:57.845Z","repository":{"id":147274567,"uuid":"346955346","full_name":"ratson/puppeteer_deno","owner":"ratson","description":"Headless Chrome Deno API","archived":false,"fork":false,"pushed_at":"2021-03-12T05:49:54.000Z","size":10052,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-26T01:33:38.641Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"htps://pptr.dev/","language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ratson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-12T05:48:49.000Z","updated_at":"2021-12-26T15:55:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"0e640133-340e-4b03-adfc-c42a7c15b812","html_url":"https://github.com/ratson/puppeteer_deno","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/ratson/puppeteer_deno","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ratson%2Fpuppeteer_deno","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ratson%2Fpuppeteer_deno/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ratson%2Fpuppeteer_deno/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ratson%2Fpuppeteer_deno/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ratson","download_url":"https://codeload.github.com/ratson/puppeteer_deno/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ratson%2Fpuppeteer_deno/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265311661,"owners_count":23745095,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-03T20:15:07.605Z","updated_at":"2025-07-14T15:06:57.834Z","avatar_url":"https://github.com/ratson.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Puppeteer Deno\n\n## Full featured Puppeteer for Deno\n\n\u003cimg src=\"https://user-images.githubusercontent.com/48787108/103984976-73539300-51cb-11eb-9d2e-655e99c9c92f.png\" height=\"200\" align=\"right\"\u003e\n\n###### [API](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/puppeteer/puppeteer/blob/main/CONTRIBUTING.md) | [Troubleshooting](https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md)\n\n\u003e Puppeteer Deno is a Deno library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n\u003c!-- [START usecases] --\u003e\n\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n- Generate screenshots and PDFs of pages.\n- Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n- Automate form submission, UI testing, keyboard input, etc.\n- Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n- Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n- Test Chrome Extensions.\n\n## Getting Started\n\n### Installation\n\nNO INSTALLATION!\nJust import puppeteer from 'https://deno.land/x/pptr/mod.ts'.\n\n### This veersion is `puppeteer-core`\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nPuppeteer Deno requires latest Deno (1.6.x).\nPuppeteer Deno's API will same with latest `puppeteer-core`.\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as _example.png_:\n\nSave file as **example.ts**\n\n```js\nimport puppeteer from 'https://deno.land/x/pptr/mod.ts';\n\nconst browser = await puppeteer.launch({\n  executablePath: '/usr/bin/google-chrome',\n});\n\nconst page = await browser.newPage();\n\nawait page.goto('https://google.com');\nawait page.screenshot({ path: 'example.png' });\n\nawait browser.close();\n```\n\nExecute script on the command line\n\n```bash\ndeno run -A example.ts\n```\n\nPuppeteer sets an initial page size to 800×600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nimport puppeteer from 'https://deno.land/x/pptr/mod.ts';\n\nconst browser = await puppeteer.launch({\n  executablePath: '/usr/bin/google-chrome',\n});\nconst page = await browser.newPage();\nawait page.goto('https://news.ycombinator.com', {\n  waitUntil: 'networkidle2',\n});\nawait page.pdf({ path: 'hn.pdf', format: 'A4' });\n\nawait browser.close();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nimport puppeteer from 'https://deno.land/x/pptr/mod.ts';\n\nconst browser = await puppeteer.launch({\n  executablePath: '/usr/bin/google-chrome',\n});\nconst page = await browser.newPage();\nawait page.goto('https://example.com');\n\n// Get the \"viewport\" of the page, as reported by the page.\nconst dimensions = await page.evaluate(() =\u003e {\n  return {\n    width: document.documentElement.clientWidth,\n    height: document.documentElement.clientHeight,\n    deviceScaleFactor: window.devicePixelRatio,\n  };\n});\n\nconsole.log('Dimensions:', dimensions);\n\nawait browser.close();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n\u003c!-- [END getstarted] --\u003e\n\n\u003c!-- [START runtimesettings] --\u003e\n\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the [`headless` option](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({ headless: false }); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nWORK IN PROGRESS\n\n```js\nconst browser = await puppeteer.launch({ executablePath: '/path/to/Chrome' });\n```\n\n\u003c!--\nYou can also use Puppeteer with Firefox Nightly (experimental support). See [`Puppeteer.launch()`](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users. --\u003e\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own browser user profile which it **cleans up on every run**.\n\n\u003c!-- [END runtimesettings] --\u003e\n\n## Resources\n\n- [API Documentation](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md)\n- [Examples](https://github.com/puppeteer/puppeteer/tree/main/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n## Debugging tips\n\n1.  Turn off headless mode - sometimes it's useful to see what the browser is\n    displaying. Instead of launching in headless mode, launch a full version of\n    the browser using `headless: false`:\n\n    ```js\n    const browser = await puppeteer.launch({ headless: false });\n    ```\n\n2.  Slow it down - the `slowMo` option slows down Puppeteer operations by the\n    specified amount of milliseconds. It's another way to help see what's going on.\n\n    ```js\n    const browser = await puppeteer.launch({\n      headless: false,\n      slowMo: 250, // slow down by 250ms\n    });\n    ```\n\n3.  Capture console output - You can listen for the `console` event.\n    This is also handy when debugging code in `page.evaluate()`:\n\n    ```js\n    page.on('console', (msg) =\u003e console.log('PAGE LOG:', msg.text()));\n\n    await page.evaluate(() =\u003e console.log(`url is ${location.href}`));\n    ```\n\n4.  Use debugger in application code browser\n\n    There are two execution context: node.js that is running test code, and the browser\n    running application code being tested. This lets you debug code in the\n    application code browser; ie code inside `evaluate()`.\n\n    - Use `{devtools: true}` when launching Puppeteer:\n\n      ```js\n      const browser = await puppeteer.launch({ devtools: true });\n      ```\n\n    - Change default test timeout:\n\n      jest: `jest.setTimeout(100000);`\n\n      jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n      mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=\u003e'](https://stackoverflow.com/a/23492442))\n\n    - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n      ```js\n      await page.evaluate(() =\u003e {\n        debugger;\n      });\n      ```\n\n      The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n\u003c!-- [START faq] --\u003e\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/puppeteer/puppeteer/blob/main/CONTRIBUTING.md).\n\n#### Q: What is the status of cross-browser support?\n\nI have never tested it on Firefox. But Chrome and Chromium is working well\n\n\u003c!-- From Puppeteer v2.1.0 onwards you can specify [`puppeteer.launch({product: 'firefox'})`](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md#puppeteerlaunchoptions) to run your Puppeteer scripts in Firefox Nightly, without any additional custom patches. While [an older experiment](https://www.npmjs.com/package/puppeteer-firefox) required a patched version of Firefox, [the current approach](https://wiki.mozilla.org/Remote) works with “stock” Firefox.\n\nWe will continue to collaborate with other browser vendors to bring Puppeteer support to browsers such as Safari.\nThis effort includes exploration of a standard for executing cross-browser commands (instead of relying on the non-standard DevTools Protocol used by Chrome). --\u003e\n\n#### Q: What are Puppeteer Deno’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a Full, Complete, Strict Typed version of Puppeteer on Deno platform.\n- Same API with original Puppeteer.\n\n#### Q: Where is `Buffer`\n\nDeno has no `Buffer`, so it is replaced with `Uint8Array`\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() =\u003e {\n  document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/puppeteer/puppeteer/issues/291).) There are two reasons for this:\n\n- Puppeteer is bundled with Chromium — not Chrome — and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n- Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I have more questions! Where do I ask?\n\nreport an ISSUE!\n\n\u003c!-- [END faq] --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fratson%2Fpuppeteer_deno","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fratson%2Fpuppeteer_deno","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fratson%2Fpuppeteer_deno/lists"}