{"id":20630188,"url":"https://github.com/macacajs/macaca-puppeteer","last_synced_at":"2025-04-15T18:19:40.077Z","repository":{"id":24076597,"uuid":"100568547","full_name":"macacajs/macaca-puppeteer","owner":"macacajs","description":"Macaca puppeteer driver","archived":false,"fork":false,"pushed_at":"2022-04-19T15:22:58.000Z","size":592,"stargazers_count":42,"open_issues_count":0,"forks_count":4,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-28T23:21:34.624Z","etag":null,"topics":["headless","macaca","puppeteer"],"latest_commit_sha":null,"homepage":"https://macacajs.github.io/guide/versioning.html","language":"JavaScript","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/macacajs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-17T06:18:10.000Z","updated_at":"2024-07-18T10:50:39.000Z","dependencies_parsed_at":"2022-07-27T04:32:07.558Z","dependency_job_id":null,"html_url":"https://github.com/macacajs/macaca-puppeteer","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macacajs%2Fmacaca-puppeteer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macacajs%2Fmacaca-puppeteer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macacajs%2Fmacaca-puppeteer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macacajs%2Fmacaca-puppeteer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/macacajs","download_url":"https://codeload.github.com/macacajs/macaca-puppeteer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248752512,"owners_count":21156106,"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":["headless","macaca","puppeteer"],"created_at":"2024-11-16T14:07:09.041Z","updated_at":"2025-04-15T18:19:40.057Z","avatar_url":"https://github.com/macacajs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# macaca-puppeteer\n\n---\n\n[![NPM version][npm-image]][npm-url]\n[![CI][CI-image]][CI-url]\n[![Test coverage][coveralls-image]][coveralls-url]\n[![node version][node-image]][node-url]\n\n[npm-image]: https://img.shields.io/npm/v/macaca-puppeteer.svg\n[npm-url]: https://npmjs.org/package/macaca-puppeteer\n[CI-image]: https://github.com/macacajs/macaca-puppeteer/actions/workflows/ci.yml/badge.svg\n[CI-url]: https://github.com/macacajs/macaca-puppeteer/actions/workflows/ci.yml\n[coveralls-image]: https://img.shields.io/coveralls/macacajs/macaca-puppeteer.svg\n[coveralls-url]: https://coveralls.io/r/macacajs/macaca-puppeteer?branch=master\n[node-image]: https://img.shields.io/badge/node.js-%3E=_8-green.svg\n[node-url]: http://nodejs.org/download/\n\n\u003e [Puppeteer](//github.com/GoogleChrome/puppeteer) is a Node library which provides a high-level API to control headless Chrome over the DevTools Protocol. It can also be configured to use full (non-headless) Chrome. Macaca Puppeteer is a long-term maintained browser driver as a candidate for Macaca Electron driver.\n\n## Installment\n\n```bash\n$ npm i macaca-puppeteer -g\n```\n\n## Usage as module\n\n```javascript\nconst fs = require('fs');\nconst path = require('path');\nconst Puppeteer = require('macaca-puppeteer');\n\nconst puppeteer = new Puppeteer();\n\nasync function() {\n  /**\n    default options\n    {\n      headless: false,\n      x: 0,\n      y: 0,\n      width: 800,\n      height: 600,\n      userAgent: 'userAgent string'\n    }\n  */\n  await puppeteer.startDevice({\n    headless: true // in silence\n  });\n\n  await puppeteer.maximize();\n  await puppeteer.setWindowSize(null, 500, 500);\n  await puppeteer.get('https://www.baidu.com');\n  const imgData = await puppeteer.getScreenshot();\n  const img = new Buffer(imgData, 'base64');\n  const p = path.join(__dirname, '..', 'screenshot.png')\n  fs.writeFileSync(p, img.toString('binary'), 'binary');\n  console.log(`screenshot: ${p}`);\n\n  await puppeteer.stopDevice();\n};\n```\n\n- [sample](//github.com/macaca-sample/sample-nodejs)\n- [More API](//macacajs.github.io/macaca-puppeteer/)\n\n\u003c!-- GITCONTRIBUTOR_START --\u003e\n\n## Contributors\n\n|[\u003cimg src=\"https://avatars.githubusercontent.com/u/1011681?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003exudafeng\u003c/b\u003e\u003c/sub\u003e](https://github.com/xudafeng)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/11460601?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003ezivyangll\u003c/b\u003e\u003c/sub\u003e](https://github.com/zivyangll)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/52845048?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003esnapre\u003c/b\u003e\u003c/sub\u003e](https://github.com/snapre)\u003cbr/\u003e|\n| :---: | :---: | :---: |\n\n\nThis project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Tue Apr 19 2022 23:22:01 GMT+0800`.\n\n\u003c!-- GITCONTRIBUTOR_END --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacacajs%2Fmacaca-puppeteer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmacacajs%2Fmacaca-puppeteer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacacajs%2Fmacaca-puppeteer/lists"}