{"id":13583208,"url":"https://github.com/moos/chromate","last_synced_at":"2025-08-31T03:31:43.000Z","repository":{"id":57198368,"uuid":"90702376","full_name":"moos/chromate","owner":"moos","description":"Automate Headless Chrome.","archived":false,"fork":false,"pushed_at":"2017-05-24T15:47:16.000Z","size":66,"stargazers_count":35,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-26T04:37:54.085Z","etag":null,"topics":["chrome","chrome-headless","phantomjs"],"latest_commit_sha":null,"homepage":null,"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/moos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-09T04:27:43.000Z","updated_at":"2023-07-22T01:51:11.000Z","dependencies_parsed_at":"2022-09-16T14:10:44.143Z","dependency_job_id":null,"html_url":"https://github.com/moos/chromate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/moos/chromate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moos%2Fchromate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moos%2Fchromate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moos%2Fchromate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moos%2Fchromate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moos","download_url":"https://codeload.github.com/moos/chromate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moos%2Fchromate/sbom","scorecard":{"id":659567,"data":{"date":"2025-08-11","repo":{"name":"github.com/moos/chromate","commit":"a11693da690905a22e52febaa17b9f96d7d44f3f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 1/27 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T15:41:10.971Z","repository_id":57198368,"created_at":"2025-08-21T15:41:10.971Z","updated_at":"2025-08-21T15:41:10.971Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272934211,"owners_count":25017816,"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","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["chrome","chrome-headless","phantomjs"],"created_at":"2024-08-01T15:03:19.669Z","updated_at":"2025-08-31T03:31:42.748Z","avatar_url":"https://github.com/moos.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"Automate [Headless Chrome](https://www.chromestatus.com/feature/5678767817097216) -- start/stop \n Chrome instances, open \u0026 close tabs, and _communicate_ with the target page.\n\n### Compatibility \n- You must use version \u003e= 59 of Chrome (currently that means [Chrome Beta](https://www.google.com/chrome/browser/beta.html)) or use [Chrome Canary](https://www.google.com/chrome/browser/canary.html).\n- Canary isn't supported on Linux platform.\n\n## Install\n```shell\nnpm install chromate\nnpm run sample\n```\n\n## Use\n```js\nlet {Chrome, Tab} = require('chromate');\n\n// start a headless Chrome process\nChrome.start().then(chrome =\u003e {\n  let tab = new Tab({\n    verbose: true,\n    failonerror: false\n  });\n  \n  tab.open(targetUrl)\n  .then(() =\u003e tab.evaluate('testResults'))\n  .then(res =\u003e console.log) // results...\n  .then(() =\u003e tab.close())\n  .then(() =\u003e {\n    Chrome.kill(chrome);\n    process.exit(0);\n  });\n});\n```\n\n### Page events\nHandle events, including any [chrome-remote-interface](https://github.com/cyrus-and/chrome-remote-interface#class-cdp) events.\n```js\nnew Tab(options)\n .on('ready', (tab) =\u003e console.log('tab is ready', tab.client.target.id))\n .on('load', () =\u003e console.log('page loaded'))\n .on('console', (args) =\u003e console.log('console.* called', args))\n .on('Network.requestWillBeSent', param =\u003e console.log('Getting resource', param.request.url))\n .once('Runtime.consoleAPICalled', param =\u003e console.log('Runtime.consoleAPICalled called', param))\n .open(targetUrl);\n```\nThe `ready` event is fired once when the target client is ready (this overrides the CDP `ready` event).  The target may\nfire any number of custom events.\n\n### Custom events\nA target page may communicate back to the controlling process by calling `console.debug(message)`, \nwhere `message`  is `{event, data}`.   This is useful for running automated tests, such as for\nreplacing [PhantomJS](http://phantomjs.org/).  See [phantom-menace](https://github.com/moos/phantom-menace) for  example.\n```js\n// useful for short messages (\u003c 100 chars)\nconsole.debug({\n  event: 'done',\n  data: JSON.stringify({foo: 1}) // must be stringify'd\n});\n\n// then, in runner process\nnew Tab()\n  .on('done', res =\u003e console.log); // {event: 'done', data: foo:1}}\n```\nA special function `__chromate(message)` is injected in target \npage to facilitate this, so that the above can be replaced by:\n```js\n// in target (useful for any length message)\nif (window.__chromate) __chromate({event: 'done', data: {foo:1}});;\n```\n\nThe format of the message is flexible, but should be sensible.  If no `event` property is found in the message,\na 'data' event is triggered.\n```js\n// in target\n__chromate('foo');\nconsole.debug({a:1});\n\n// in runner\ntab.on('data', res =\u003e console.log); // 'foo' and {a:1}\n```\n\n### Script injection\nOften it's useful for the running script to inject custom JS into the target page.  This can \n  be done thorough [Page.addScriptToEvaluateOnLoad()](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-addScriptToEvaluateOnLoad)\n  or the [Runtime.evaluate()](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#method-evaluate) method. \nTwo helper methods are provided: `tab.evaluate()` and `tab.execute()`:\n```js\nnew Tab()\n  .on('done', (res, tab) =\u003e {\n     tab.evaluate('JSON.stringify(__coverage__)')\n       .then(result =\u003e console.log(result))\n       .then(() =\u003e tab.close());\n  })\n  .open(targetUrl);\n```\nOr execute a (named) function in target.\n```js\nnew Tab()\n  .open(targetUrl)\n  .then(tab =\u003e {\n    tab.execute('getResult').then(res =\u003e console.log);\n  })\n  \n// in target\nfunction getResult() {\n  return JSON.stringify(result);\n}\n```\n`tab.execute()` takes additional parameters to pass as arguments to the function.\nIf the function is expected to return a Promise, pass a `{awaitPromise: true}` as the\nlast argument.\n\n## API\n\nSee [API docs](./api.md).\n\n\n## Simple CLI\nUsage:\n```shell\n$ chromate\nUsage: chromate start [\u003cchrome flags\u003e] | list | kill \u003cpid\u003e ... | killall | version | open \u003curl\u003e | \n    list-tabs | close \u003ctabId\u003e | close-tabs  [--canary | --verbose | -v]\n```\n\n### Chrome process control\n```shell\n$ chromate start --window-size=800x600 --canary\n42706: /Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary\n  --remote-debugging-port=9222 --headless --disable-gpu\n  --user-data-dir=/var/folders/jl/zr54cdxs08l1djw8s4ws2t540000gn/T/chrome-PdvzfF \n  --window-size=800x600 --canary --disable-translate --disable-extensions\n  --disable-background-networking --safebrowsing-disable-auto-update --disable-sync\n  --metrics-recording-only --disable-default-apps --no-first-run \n  --disable-background-timer-throttling --disable-renderer-backgrounding\n  --disable-device-discovery-notifications\n\n$ chromate list\n[ { pid: '42706',\n    command: '/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary',\n    arguments:\n     [ '--remote-debugging-port=9222',\n       '--headless',\n       '--disable-gpu',\n       '--user-data-dir=/var/folders/jl/zr54cdxs08l1djw8s4ws2t540000gn/T/chrome-PdvzfF',\n       '--window-size=800x600',\n       '--canary',\n       '--disable-translate',\n       '--disable-extensions',\n       '--disable-background-networking',\n       '--safebrowsing-disable-auto-update',\n       '--disable-sync',\n       '--metrics-recording-only',\n       '--disable-default-apps',\n       '--no-first-run',\n       '--disable-background-timer-throttling',\n       '--disable-renderer-backgrounding',\n       '--disable-device-discovery-notifications' ],\n    ppid: '1' } ]\n    \n$ chromate killall \n2\n```\n`killall` returns the number of processes (including sub-processes) killed.\n\nFor list of Chrome _Headless_ flags, [see here](https://cs.chromium.org/chromium/src/headless/app/headless_shell_switches.cc). Of course, [any Chrome flag](http://peter.sh/experiments/chromium-command-line-switches/) can be specified.\n\nTo use a custom Chrome path and/or port, use:\n```shell\n$ CHROME_BIN=/path/to/chrome CHROME_PORT=9226 chromate start\n```\n\n### Chrome tab control\n```shell\n$ chromate open https://github.com\n{ description: '',\n  devtoolsFrontendUrl: '/devtools/inspector.html?ws=localhost:9222/devtools/page/904ddfa4-2344-4e45-a625-8261ffbee251',\n  id: '904ddfa4-2344-4e45-a625-8261ffbee251',\n  title: '',\n  type: 'page',\n  url: 'about:blank',\n  webSocketDebuggerUrl: 'ws://localhost:9222/devtools/page/904ddfa4-2344-4e45-a625-8261ffbee251' }\n\n$ chromate list-tabs\n[ { description: '',\n    devtoolsFrontendUrl: '/devtools/inspector.html?ws=localhost:9222/devtools/page/e97b0e1e-1fb5-41be-83d2-bdb9fbc406bc',\n    id: 'e97b0e1e-1fb5-41be-83d2-bdb9fbc406bc',\n    title: 'The world\u0026#39;s leading software development platform · GitHub',\n    type: 'page',\n    url: 'https://github.com/',\n    webSocketDebuggerUrl: 'ws://localhost:9222/devtools/page/e97b0e1e-1fb5-41be-83d2-bdb9fbc406bc' },\n  { description: '',\n    devtoolsFrontendUrl: '/devtools/inspector.html?ws=localhost:9222/devtools/page/e4c16358-7670-4deb-8b2e-29f802e599a3',\n    id: 'e4c16358-7670-4deb-8b2e-29f802e599a3',\n    title: 'about:blank',\n    type: 'page',\n    url: 'about:blank',\n    webSocketDebuggerUrl: 'ws://localhost:9222/devtools/page/e4c16358-7670-4deb-8b2e-29f802e599a3' } ]\n\n$ chromate close-tabs\n2\n```\n\n## Test\n```shell\n# npm i -g mocha  (if you don't already have it)\nnpm test\n```\n\n\n## Thanks and references\n- This library is based on the awesome work of [chrome-remote-interface](https://www.npmjs.com/package/chrome-remote-interface)\n- Idea for Chrome.ready() taken from [Lighthouse](https://github.com/GoogleChrome/lighthouse)\n- [DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/) complete reference.\n- [Getting Started with Headless Chrome](https://developers.google.com/web/updates/2017/04/headless-chrome)\n\n## Change log\n\n- v0.3.5 - Readme update.\n- v0.3.4 - Added Chrome.settings.userDataDir.  By default a temporary user data dir is used and cleaned up.  \n- v0.3.3 - fixed 'ps-node' reference\n- v0.3.2 - fixed internal print() method\n- v0.3.1 - added events 'abort', 'exception', and 'console.*'.  Export chromate.version.\n- v0.3.0 - tab.open(url) takes url rather than constructor.  tab.execute can take a local function.  Use ps-moos with fix for spaces in path.\n- v0.2.0 - Added expression and function evaluation and __chromate global for general message passing.  Events now get complete message, not just the data part. (May 2017)\n- v0.1.x - Initial version (May 2017)\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoos%2Fchromate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoos%2Fchromate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoos%2Fchromate/lists"}