{"id":15553111,"url":"https://github.com/bahmutov/cypress-cdp","last_synced_at":"2025-09-28T22:30:41.912Z","repository":{"id":37169271,"uuid":"481935146","full_name":"bahmutov/cypress-cdp","owner":"bahmutov","description":"A custom Cypress command to wrap the remote debugger protocol low level command","archived":false,"fork":false,"pushed_at":"2025-09-24T18:29:29.000Z","size":902,"stargazers_count":19,"open_issues_count":10,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-24T20:27:28.897Z","etag":null,"topics":["cypress-plugin"],"latest_commit_sha":null,"homepage":"https://glebbahmutov.com/blog/when-can-the-test-click/","language":"JavaScript","has_issues":true,"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/bahmutov.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-04-15T11:22:03.000Z","updated_at":"2025-08-23T01:49:37.000Z","dependencies_parsed_at":"2023-10-12T13:23:37.815Z","dependency_job_id":"7e6b6b56-1afc-4aba-9dea-622fdbb01232","html_url":"https://github.com/bahmutov/cypress-cdp","commit_stats":{"total_commits":36,"total_committers":6,"mean_commits":6.0,"dds":0.4444444444444444,"last_synced_commit":"931b5457154ca409689edd46680518bbf3a2da59"},"previous_names":[],"tags_count":131,"template":false,"template_full_name":null,"purl":"pkg:github/bahmutov/cypress-cdp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fcypress-cdp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fcypress-cdp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fcypress-cdp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fcypress-cdp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bahmutov","download_url":"https://codeload.github.com/bahmutov/cypress-cdp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fcypress-cdp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276966311,"owners_count":25736754,"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-09-25T02:00:09.612Z","response_time":80,"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":["cypress-plugin"],"created_at":"2024-10-02T14:24:29.459Z","updated_at":"2025-09-28T22:30:41.580Z","avatar_url":"https://github.com/bahmutov.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cypress-cdp [![ci](https://github.com/bahmutov/cypress-cdp/actions/workflows/ci.yml/badge.svg?branch=main\u0026event=push)](https://github.com/bahmutov/cypress-cdp/actions/workflows/ci.yml) ![cypress version](https://img.shields.io/badge/cypress-13.17.0-brightgreen)\n\n\u003e A custom Cypress command to wrap the [Chrome remote debugger protocol](https://chromedevtools.github.io/devtools-protocol/) low level command\n\nRead my blog posts that show this plugin in action:\n\n- [Cypress automation](https://glebbahmutov.com/blog/cypress-automation/)\n- [When Can The Test Click](https://glebbahmutov.com/blog/when-can-the-test-click/)\n- [Solve The First Click](https://glebbahmutov.com/blog/solve-the-first-click/)\n- [Rendered font](https://glebbahmutov.com/blog/rendered-font/)\n- [Emulate Media In Cypress Tests](https://glebbahmutov.com/blog/cypress-emulate-media/)\n- [Testing CSS Print Media Styles](https://glebbahmutov.com/blog/test-print-styles/)\n\n🎓 Covered in my course [Cypress Plugins](https://cypress.tips/courses/cypress-plugins), [Cypress Network Testing Exercises](https://cypress.tips/courses/network-testing), and [TDD Calculator](https://cypress.tips/courses/tdd-calculator):\n- [Lesson e5: Print page as PDF](https://cypress.tips/courses/tdd-calculator/lessons/e5)\n- [Lesson c6: Exit fullscreen mode using cypress-cdp](https://cypress.tips/courses/cypress-plugins/lessons/c6)\n- [Lesson c7: Set custom timezone and locale](https://cypress.tips/courses/cypress-plugins/lessons/c7)\n- [Lesson c9: Disable network caching during the test](https://cypress.tips/courses/cypress-plugins/lessons/c9)\n- [Bonus 99: Confirm the form works with CSS styles disabled](https://cypress.tips/courses/network-testing/lessons/bonus99)\n\n## Install\n\nAdd this plugin as your dev dependency\n\n```\n# install using NPM\n$ npm i -D cypress-cdp\n# or install using Yarn\n$ yarn add -D cypress-cdp\n```\n\nThen import this plugin in your spec or support file\n\n```js\n// https://github.com/bahmutov/cypress-cdp\nimport 'cypress-cdp'\n```\n\n## Examples\n\n### Disable caching\n\nSimilar to clicking the checkbox \"Disable cache\" in the Network tab\n\n```js\nimport 'cypress-cdp'\ncy.CDP('Network.setCacheDisabled', {\n  cacheDisabled: true,\n})\n```\n\n## API\n\n### CDP\n\n#### CDP example 1\n\n```js\nconst selector = 'button#one'\ncy.CDP('Runtime.evaluate', {\n  expression: 'frames[0].document.querySelector(\"' + selector + '\")',\n}).should((v) =\u003e {\n  expect(v.result).to.have.property('objectId')\n})\n```\n\n**Tip:** be careful with selectors, you probably will need to escape them. For example, this library uses this escape\n\n```js\nconst escapedSelector = JSON.stringify(selector)\ncy.CDP('Runtime.evaluate', {\n  expression: 'frames[0].document.querySelector(' + escapedSelector + ')',\n})\n```\n\n### hasEventListeners\n\n#### hasEventListeners example\n\n```js\n// any event listeners are attached\ncy.hasEventListeners('button#one')\n// \"click\" event listeners are attached\ncy.hasEventListeners('button#one', { type: 'click' })\n```\n\n### getCDPNodeId\n\nReturns the internal element's Node Id that can be used to query the run-time properties, for example the rendered font.\n\n```js\ncy.getCDPNodeId('body').then((nodeId) =\u003e {\n  cy.CDP('CSS.getPlatformFontsForNode', {\n    nodeId,\n  })\n})\n```\n\n## Type definitions\n\nDefined in [src/index.d.ts](./src/index.d.ts) and copied from the original [PR 66237](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/66237). If you want your project to \"know\" the `cy.CDP` command, include this dependency, for example:\n\n```json\n{\n  \"types\": [\"cypress\", \"cypress-cdp\"]\n}\n```\n\n## Small print\n\nAuthor: Gleb Bahmutov \u0026lt;gleb.bahmutov@gmail.com\u0026gt; \u0026copy; 2022\n\n- [@bahmutov](https://twitter.com/bahmutov)\n- [glebbahmutov.com](https://glebbahmutov.com)\n- [blog](https://glebbahmutov.com/blog)\n- [videos](https://www.youtube.com/glebbahmutov)\n- [presentations](https://slides.com/bahmutov)\n- [cypress.tips](https://cypress.tips)\n- [Cypress Tips \u0026 Tricks Newsletter](https://cypresstips.substack.com/)\n- [my Cypress courses](https://cypress.tips/courses)\n\nLicense: MIT - do anything with the code, but don't blame me if it does not work.\n\nSupport: if you find any problems with this module, email / tweet /\n[open issue](https://github.com/bahmutov/cypress-cdp/issues) on Github\n\n## MIT License\n\nCopyright (c) 2022 Gleb Bahmutov \u0026lt;gleb.bahmutov@gmail.com\u0026gt;\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahmutov%2Fcypress-cdp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbahmutov%2Fcypress-cdp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahmutov%2Fcypress-cdp/lists"}