Self-contained — built-in CDP client, no external browser-client gem required. Capybara →
capybara-lightpanda → Install
Add this to your Gemfile and run bundle install:
group :test do
gem "capybara-lightpanda"
end
In your test setup:
require "capybara-lightpanda"
Capybara.javascript_driver = :lightpanda
[!TIP] The Lightpanda binary is auto-downloaded on first use — no separate install step needed.
[!IMPORTANT] Lightpanda is a headless agentic browser, not a layout engine. By design it does not fetch external
<link rel="stylesheet">, evaluate@mediarules, or implementwindow.matchMedia(). Any spec whose visibility depends on responsive CSS — for example a mobile/desktop CTA pair hidden via@media (min-width: …)— should stay on Cuprite (or whichever full-browser driver you were already using). The dual-driver setup routes the layout-sensitive minority to Cuprite and the structural majority to Lightpanda for speed.
Credits
- Lightpanda — the headless browser
- Capybara — the test framework
- Inspired by the Cuprite / Ferrum architecture and
lightpanda-ruby
Patterns adapted from these MIT-licensed projects (cookies API, frame switching, node call/error conventions, retry/event utilities) are acknowledged with the original copyright notices in NOTICE.md.
Contributing
Bug reports and pull requests are welcome on GitHub.
For beta-testing tips and how to file useful feedback, see BETA_TESTING.md.