{"id":13527439,"url":"https://github.com/lucacasonato/deno-puppeteer","last_synced_at":"2025-04-04T22:06:21.481Z","repository":{"id":37463360,"uuid":"325334850","full_name":"lucacasonato/deno-puppeteer","owner":"lucacasonato","description":"A port of puppeteer running on Deno","archived":false,"fork":false,"pushed_at":"2023-12-01T06:57:02.000Z","size":667,"stargazers_count":458,"open_issues_count":43,"forks_count":45,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T21:04:00.792Z","etag":null,"topics":["automation","deno","headless-chrome","puppeteer","testing","web"],"latest_commit_sha":null,"homepage":"https://deno.land/x/puppeteer","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lucacasonato.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"github":"lucacasonato"}},"created_at":"2020-12-29T16:28:36.000Z","updated_at":"2025-03-18T06:30:51.000Z","dependencies_parsed_at":"2024-09-14T00:11:49.746Z","dependency_job_id":"a910e8e0-43b9-4e90-b1c7-ce6fb78f9f4a","html_url":"https://github.com/lucacasonato/deno-puppeteer","commit_stats":{"total_commits":32,"total_committers":8,"mean_commits":4.0,"dds":0.40625,"last_synced_commit":"45b3162585b98ad8d54abeb56f48ecbb17c614eb"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucacasonato%2Fdeno-puppeteer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucacasonato%2Fdeno-puppeteer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucacasonato%2Fdeno-puppeteer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucacasonato%2Fdeno-puppeteer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucacasonato","download_url":"https://codeload.github.com/lucacasonato/deno-puppeteer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247256112,"owners_count":20909240,"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":["automation","deno","headless-chrome","puppeteer","testing","web"],"created_at":"2024-08-01T06:01:47.939Z","updated_at":"2025-04-04T22:06:21.457Z","avatar_url":"https://github.com/lucacasonato.png","language":"TypeScript","funding_links":["https://github.com/sponsors/lucacasonato"],"categories":["TypeScript","Modules","automation","测试工具（保证代码质量用）"],"sub_categories":["Assistants","静态网站生成（写博客/文档用）","Testing"],"readme":"# deno-puppeteer\n\n\u003cimg src=\"./logo.png\" height=\"200\" align=\"right\"\u003e\n\n###### [API](https://github.com/puppeteer/puppeteer/blob/v16.2.0/docs/api.md)\n\nA fork of [Puppeteer](https://pptr.dev/) running on Deno.\n\n\u003e Puppeteer is a library which provides a high-level API to control Chrome,\n\u003e Chromium, or Firefox Nightly over the DevTools Protocol. Puppeteer runs\n\u003e headless by default, but can be configured to run full (non-headless) Chrome\n\u003e or Chromium.\n\nMost things that you can do manually in the browser can be done using Puppeteer!\nHere 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.\n  \"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\n  in the latest version of Chrome using the latest JavaScript and browser\n  features.\n- Capture a timeline trace of your site to help diagnose performance issues.\n- Test Chrome Extensions.\n\n## Getting Started\n\n### Installation\n\nTo use Puppeteer, import it like so:\n\n```ts\nimport puppeteer from \"https://deno.land/x/puppeteer@16.2.0/mod.ts\";\n```\n\nPuppeteer can use any recent version of Chromium or Firefox Nightly, but this\nversion of Puppeteer is only validated against a specific version. To cache\nthese versions in the Puppeteer cache, run the commands below.\n\n```shell\nPUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/puppeteer@16.2.0/install.ts\nPUPPETEER_PRODUCT=firefox deno run -A --unstable https://deno.land/x/puppeteer@16.2.0/install.ts\n```\n\nYou can find all of the supported environment variables to customize\ninstallation\n[in the Puppeteer docs](https://pptr.dev/#?product=Puppeteer\u0026version=v16.2.0\u0026show=api-environment-variables).\n\n### Usage\n\nPuppeteer will be familiar to people using other browser testing frameworks. You\ncreate an instance of `Browser`, open pages, and then manipulate them with\nPuppeteer's API.\n\n**Example** - navigating to https://example.com and saving a screenshot as\n_example.png_:\n\nSave file as **example.js**\n\n```js\nimport puppeteer from \"https://deno.land/x/puppeteer@16.2.0/mod.ts\";\n\nconst browser = await puppeteer.launch();\nconst page = await browser.newPage();\nawait page.goto(\"https://example.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 --unstable example.js\n```\n\nPuppeteer sets an initial page size to 800×600px, which defines the screenshot\nsize. The page size can be customized with\n[`Page.setViewport()`](https://github.com/puppeteer/puppeteer/blob/v16.2.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/puppeteer@16.2.0/mod.ts\";\n\nconst browser = await puppeteer.launch();\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\ndeno run -A --unstable hn.js\n```\n\nSee\n[`Page.pdf()`](https://github.com/puppeteer/puppeteer/blob/v16.2.0/docs/api.md#pagepdfoptions)\nfor 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/puppeteer@16.2.0/mod.ts\";\n\nconst browser = await puppeteer.launch();\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\ndeno run -A --unstable get-dimensions.js\n```\n\n## FAQ\n\n### How does deno-puppeteer compare to the Node version?\n\n`deno-puppeteer` effectively runs a regular version of Puppeteer, except for\nsome minor changes to make it compatible with Deno.\n\nThe most noticable difference is likely that instead of some methods taking /\nreturning Node `Buffer`, they take / return `Uint8Array`. One method also\nreturns a web native `ReadableStream` instead of the Node `Readable`.\n\nOther than this, the documentation on https://pptr.dev generally applies.\n\n### How to run in Docker?\n\nAn example Dockerfile can be found in this repository. It will install all\nnecessary dependencies, and shows how to run the ./examples/docker.js.\n\nIt is just meant as a jumping off point - customize it as you wish.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucacasonato%2Fdeno-puppeteer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucacasonato%2Fdeno-puppeteer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucacasonato%2Fdeno-puppeteer/lists"}