{"id":27716053,"url":"https://github.com/jacarte/ws_chrome_debugging_example","last_synced_at":"2026-03-04T17:32:49.327Z","repository":{"id":35285185,"uuid":"185999634","full_name":"Jacarte/ws_chrome_debugging_example","owner":"Jacarte","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-11T02:46:35.000Z","size":18413,"stargazers_count":4,"open_issues_count":10,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-05T02:22:38.709Z","etag":null,"topics":["chrome","chrome-remote-interface","js","nodejs"],"latest_commit_sha":null,"homepage":null,"language":null,"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/Jacarte.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}},"created_at":"2019-05-10T14:11:54.000Z","updated_at":"2020-04-11T12:23:34.000Z","dependencies_parsed_at":"2023-01-15T17:45:16.611Z","dependency_job_id":null,"html_url":"https://github.com/Jacarte/ws_chrome_debugging_example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Jacarte/ws_chrome_debugging_example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacarte%2Fws_chrome_debugging_example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacarte%2Fws_chrome_debugging_example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacarte%2Fws_chrome_debugging_example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacarte%2Fws_chrome_debugging_example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jacarte","download_url":"https://codeload.github.com/Jacarte/ws_chrome_debugging_example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacarte%2Fws_chrome_debugging_example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30087381,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T15:40:14.053Z","status":"ssl_error","status_checked_at":"2026-03-04T15:40:13.655Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-remote-interface","js","nodejs"],"created_at":"2025-04-27T01:44:52.566Z","updated_at":"2026-03-04T17:32:49.290Z","avatar_url":"https://github.com/Jacarte.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Listen to chrome websocket debugging interface\n\n## Basic workflow\n\n0. Choose the debugging port: i.e. 9222\n1. Open your browser with --remote-debugging-port=9222\n3. Execute query to http://localhost:9222/json\n4. The resulting json is something like this:\n    ```json\n    [ {\n    \"description\": \"\",\n    \"devtoolsFrontendUrl\": \"/devtools/inspector.html?ws=localhost:9222/devtools/page/926A781407E057C7AE6A2C6F1E61B371\",\n    \"id\": \"926A781407E057C7AE6A2C6F1E61B371\",\n    \"title\": \"Document\",\n    \"type\": \"page\",\n    \"url\": \"https://kth.se\",\n    \"webSocketDebuggerUrl\": \"ws://localhost:9222/devtools/page/926A781407E057C7AE6A2C6F1E61B371\"\n    } ]\n    ```\n    Every tab in the browser session will be represented in this json object as an array entry. The properties of each entry are: page description, id, title of the page, url of the page and the websocket address to access the debugging interface.\n5. Then, open a websocket channel targeting the tab **webSocketDebuggerUrl**\n6. Start to talking to chrome debugging interface like Runtime.enable method call \u003chttps://chromedevtools.github.io/devtools-protocol/v8/Runtime\u003e at open channel event.\n    - [Runtime channel](https://chromedevtools.github.io/devtools-protocol/tot/Runtime) \n    ```js\n    // NodeJS example\n\n        ws.send(\n            JSON.stringify({{id: 1, method: 'Runtime.enable'}}))\n    ```\n\n    - [Network profiler](https://chromedevtools.github.io/devtools-protocol/tot/Network) \n    ```js\n    // NodeJS example\n\n    ws.send(\n        JSON.stringify({{id: 1, method: 'Network.enable'}}))\n    ```\n\n\n7. Listen for incoming messages:\n```js\n// NodeJS example\nws.on('message', function incoming(data) {\n    console.log(data);\n});\n```\n\n## How to execute remote methods ?\n\nFollowing the DevTools [documentation](https://chromedevtools.github.io/devtools-protocol/v8/Profiler), basically to run it, you need to send a WS message as follows:\n\n```json\n{\n    \"id\": \"RequestUniqueID\",\n    \"method\": \"MethodName\",\n    \"params\": {\n        \"key\": \"value\" // For each value described as parameter in documentation\n    }\n}\n```\n\n\nThe call result is showed in the Runtime listener with the unique sent Id as identifier\n\n```json\n{\n    \"id\":\"RequestUniqueID\",\n    \"result\":\n        {\n            \"result\":\n            {\n                \"type\":\"undefined\"\n            }\n        }\n}\n```\n\nExample: Execute JavaScript code in specific page\n\n```js\n// NodeJS example\n\nws.send({\n    \"id\": 4,\n    \"method\": \"Runtime.enable\"\n})\n\nws.send({\n    \"id\": 2,\n    \"method\": \"Runtime.evaluate\",\n    \"params\": {\n        \"expression\": \"1 + 2\"\n    }\n})\n\n```\nResult \n\n```json\n{\n    \"id\":2,\n    \"result\":\n    {\n        \"result\":\n        {\n            \"type\":\"number\",\n            \"value\":2,\n            \"description\":\"2\"\n        }\n    }\n}\n```\n\n## Examples\n\n- Create your own integration test tool from scratch [Link](examples/IT_demo)\n- Processing network events [Link](examples/networking)\n- Capture screen images [Link](examples/recording)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacarte%2Fws_chrome_debugging_example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacarte%2Fws_chrome_debugging_example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacarte%2Fws_chrome_debugging_example/lists"}