{"id":13722446,"url":"https://github.com/sandro/capybara-chrome","last_synced_at":"2026-05-01T13:00:55.697Z","repository":{"id":50089850,"uuid":"137823637","full_name":"sandro/capybara-chrome","owner":"sandro","description":"Chrome driver for Capybara using Chrome's remote debugging protocol","archived":false,"fork":false,"pushed_at":"2021-06-04T16:41:43.000Z","size":77,"stargazers_count":28,"open_issues_count":2,"forks_count":3,"subscribers_count":13,"default_branch":"master","last_synced_at":"2026-04-07T15:10:50.811Z","etag":null,"topics":["capybara","headless","headless-chrome","rspec","testing"],"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/sandro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-19T01:11:36.000Z","updated_at":"2023-09-08T17:41:53.000Z","dependencies_parsed_at":"2022-08-03T18:45:13.674Z","dependency_job_id":null,"html_url":"https://github.com/sandro/capybara-chrome","commit_stats":null,"previous_names":["carezone/capybara-chrome"],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/sandro/capybara-chrome","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandro%2Fcapybara-chrome","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandro%2Fcapybara-chrome/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandro%2Fcapybara-chrome/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandro%2Fcapybara-chrome/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sandro","download_url":"https://codeload.github.com/sandro/capybara-chrome/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandro%2Fcapybara-chrome/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32497815,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"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":["capybara","headless","headless-chrome","rspec","testing"],"created_at":"2024-08-03T01:01:28.828Z","updated_at":"2026-05-01T13:00:55.678Z","avatar_url":"https://github.com/sandro.png","language":"Ruby","funding_links":[],"categories":["Related"],"sub_categories":[],"readme":"# Capybara::Chrome\n\nUse [Capybara](https://github.com/teamcapybara/capybara) to drive Chrome in headless mode via the [debugging protocol](https://chromedevtools.github.io/devtools-protocol/).\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'capybara-chrome'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install capybara-chrome\n    \n### Using Docker\n\nAdd this line to your Dockerfile to install Chrome:\n  \n```dockerfile\n  RUN curl -sL -o chrome-stable.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb ; dpkg -i chrome-stable.deb ; apt-get install -fy; rm -rf /var/lib/apt/lists/*\n```\n\nIn my experience, headless Chrome cannot be run as root, so you need to run `rspec` as an unprivileged user and use this flag with `docker run`\n\n```bash\ndocker run --security-opt seccomp=unconfined\n```\n  \n\n## Usage\n\n```ruby\nCapybara.javascript_driver = :chrome\nCapybara::Chrome.configuration.chrome_port = 9222 # optional\n```\n\nThe standard port for the debugging protocol is `9222`. Visit `localhost:9222` in a Chrome tab to watch the tests execute. Note, the port will be random by default.\n\n### Using thin\n\nI like using [thin](https://github.com/macournoyer/thin) instead of WEBrick as\nmy Capybara server. It's a little faster, gives me greater control of logging,\nshows errors, and allows me to disable signal handlers.\nBelow are my settings:\n\n```ruby\nCapybara.register_server :thin do |app, port, host|\n  require \"rack/handler/thin\"\n  Thin::Logging.silent = false\n  # Thin::Logging.debug = true # uncomment to see request and response codes\n  # Thin::Logging.trace = true # uncomment to see full requests/responses\n  Rack::Handler::Thin.run(app, Host: host, Port: port, signals: false)\nend\nCapybara.server = :thin\n```\n\n### Debugging\n\nUse `byebug` instead of `binding.pry` when debugging a test. The Pry debugger tends to hang when `visit` is called.\n\n### Using the repl\n\nYou can use the capybara-chrome browser without providing a rack app. This can be helpful in debugging.\n\n```\n[2] pry(main)\u003e driver = Capybara::Chrome::Driver.new(nil, port:9222); driver.start; browser = driver.browser\n[3] pry(main)\u003e browser.visit \"http://google.com\"\n=\u003e true\n[4] pry(main)\u003e browser.current_url\n=\u003e \"https://www.google.com/?gws_rd=ssl\"\n[5] pry(main)\u003e\n\n```\n\nFurther, you can run a local netcat server and point the capybara-chrome browser to it to see the entire request that's being sent.\n\nTerminal one contains the browser:\n\n```\n[1] pry(main)\u003e driver = Capybara::Chrome::Driver.new(nil, port:9222); driver.start; browser = driver.browser\n[2] pry(main)\u003e browser.header \"x-foo\", \"bar\"\n[3] pry(main)\u003e browser.visit \"http://localhost:8000\"\n```\n\nTerminal two prints the request\n\n```\n$ while true; do { echo -e \"HTTP/1.1 200 OK \\r\\n\"; echo \"hi\"; } | nc -l 8000; done\nGET / HTTP/1.1\nHost: localhost:8000\nConnection: keep-alive\nUpgrade-Insecure-Requests: 1\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/68.0.3440.106 Safari/537.36\nx-foo: bar\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\nAccept-Encoding: gzip, deflate\n```\n\n### Videos\n\nA video showing capybara-chrome running in a browser tab\n\n[![Preview of visualizing capybara-chrome](http://img.youtube.com/vi/SLmkx5z-lAA/0.jpg)](http://www.youtube.com/watch?v=SLmkx5z-lAA)\n\nA video demonstrating debugging an rspec test with `byebug`\n\n[![Preview of debugging capybara-chrome](http://img.youtube.com/vi/McEQG9YEAdE/0.jpg)](http://www.youtube.com/watch?v=McEQG9YEAdE)\n\nA video showing capybara-chrome running against a netcat backend\n\n[![Preview of debugging capybara-chrome with netcat](http://img.youtube.com/vi/B1__LeLyXBo/0.jpg)](http://www.youtube.com/watch?v=B1__LeLyXBo)\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/sandro/capybara-chrome.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandro%2Fcapybara-chrome","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsandro%2Fcapybara-chrome","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandro%2Fcapybara-chrome/lists"}