{"id":14978897,"url":"https://github.com/tylerrick/capybara-chrome_dev_tools","last_synced_at":"2025-06-13T11:07:46.761Z","repository":{"id":62555121,"uuid":"162650120","full_name":"TylerRick/capybara-chrome_dev_tools","owner":"TylerRick","description":"Integrates chrome_remote (a Chrome DevTools Protocol client) with Capybara, letting you access Chrome DevTools via `driver.dev_tools`.","archived":false,"fork":false,"pushed_at":"2018-12-21T18:14:51.000Z","size":9,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-13T11:07:20.573Z","etag":null,"topics":["capybara","capybara-library","chrome","chrome-devtools-protocol","chrome-remote","crmux","ruby","selenium-webdriver"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/TylerRick.png","metadata":{"files":{"readme":"Readme.md","changelog":"Changelog.md","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":"2018-12-21T01:32:27.000Z","updated_at":"2020-09-11T08:15:59.000Z","dependencies_parsed_at":"2022-11-03T05:30:32.186Z","dependency_job_id":null,"html_url":"https://github.com/TylerRick/capybara-chrome_dev_tools","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/TylerRick/capybara-chrome_dev_tools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylerRick%2Fcapybara-chrome_dev_tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylerRick%2Fcapybara-chrome_dev_tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylerRick%2Fcapybara-chrome_dev_tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylerRick%2Fcapybara-chrome_dev_tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TylerRick","download_url":"https://codeload.github.com/TylerRick/capybara-chrome_dev_tools/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylerRick%2Fcapybara-chrome_dev_tools/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259634348,"owners_count":22887697,"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":["capybara","capybara-library","chrome","chrome-devtools-protocol","chrome-remote","crmux","ruby","selenium-webdriver"],"created_at":"2024-09-24T13:58:36.007Z","updated_at":"2025-06-13T11:07:46.732Z","avatar_url":"https://github.com/TylerRick.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Capybara::ChromeDevTools\n\nIntegrates [chrome_remote](https://github.com/cavalle/chrome_remote) (a Chrome DevTools Protocol\nclient) with Capybara, letting you access Chrome DevTools via `driver.dev_tools`.\n\n## What it does for you\n\n- Finds a free port and sets Chrome's --remote-debugging-port to this known port\n- Starts [`crmux`](https://github.com/sidorares/crmux) so that you can make additional connections\n  to the Chrome DevTools/debugging port even while `chromedriver` continues to connect to the\n  `--remote-debugging-port` (Chrome normally only allows one debugging session to be connected to a\n  tab)\n- Lets you inspect the browser window your tests are running in — even if they are running in a\n  headless Chrome browser!\n- Exposes a `dev_tools` method that provides access to a `ChromeRemote` instance (see\n  [capybara-chrome_response_headers](https://github.com/TylerRick/capybara-chrome_response_headers),\n  for one possible use for that)\n\nInspired by: https://stackoverflow.com/a/50876153/47185\n\n## Installation\n\nInstall [`crmux`](https://github.com/sidorares/crmux) by running, for example:\n```\nnpm install crmux -g\n```\nor\n```\nyarn add crmux\n```\n\nTest that you can run it with:\n```\nnpx crmux --help\n```\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'capybara-chrome_dev_tools'\n```\n\n## Usage\n\nEnable this extension like so:\n```\nCapybara::ChromeDevTools.enabled = true\n```\n\n... before you do any action with Capybara that triggers it to use the Chrome driver/browser.\n\n### Accessing DevTools from another Chrome window\n\nAdd some code to your test to make it _pause_ at the point where you want to inspect the state of\nthe browser window. Otherwise, when the test finishes, it will close the window that you are\ninspecting and disconnect the DevTools frontend that you were using to view it.\n\nLook for the output which teels you which port it's listening to:\n\n```\nStarted crmux [pid 56630], listening at http://localhost:35720, connected to localhost:35719\n```\n\nNow you can go to http://localhost:35720, choose which window to inspect, and inspect the Chrome\nwindow that your tests are running in — all from this other Chrome browser instance!\n\nYou can also get the listen port from `driver.crmux_listen_port` if you want to\nautomate things.\n\n### Accessing DevTools from Ruby\n\nAccess a ChromeRemote instance with `dev_tools`.\n\nSee [chrome_remote](https://github.com/cavalle/chrome_remote) for API documentation.\n\nExample:\n```ruby\ndev_tools.send_cmd \"Page.enable\"\n```\n\n## Status\n\nThis project should be considered a proof of concept.\n\nIt generally works, but isn't exceptionally resilient or stable.\n\nSometimes you may get intermittent errors from `chrome_remote` or the WebSocket connection. There\nshould probably be some handling of these errors (or better yet, figure out what's causing the\nerrors).\n\n## See also\n\nTo get access to HTTP response status code, response headers, etc. from your tests, check out https://github.com/TylerRick/capybara-chrome_response_headers, which uses this gem.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/TylerRick/capybara-chrome_dev_tools.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftylerrick%2Fcapybara-chrome_dev_tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftylerrick%2Fcapybara-chrome_dev_tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftylerrick%2Fcapybara-chrome_dev_tools/lists"}