r/ruby • u/jrochkind • Jun 22 '26
Q: Claude Code able to run capybara tests with chromedriver?
I am pretty new to using Claude Code at all, late on the game. I am finding troubleshooting some aspects of it to be very confusing compared to the kind of dev setup I am used to!
I am using it from the claude CLI directly, on latest MacOS 26.5.1.
I definitely want Claude Code to be able to run my entire test suite -- including capybara tests that use headless chromedriver via selenium.
And there is the rub! The (new?) sandboxing that Claude Code now has on MacOS seems to conflict with running chromedriver. I think? It's hard to tell what is going wrong.
I can find (or have claude suggest) various possible solutions, but they all seem to me like some combination of more dangerous than I want (I don't really want to turn off sandboxing generally?) or annoying UI asking me permission to run rspec every time it runs. (I anticipate some workflows where it runs rspec a LOT, I'd think this is normal?)
I'm curious what actual people using claude code with ruby/rails on Mac have done here, what have you done to get claude code to be able to run rspec that launches chromedriver, what's working for you? I would think making sure Claude Code can run rspec and your entire test suite (including system tests with chromedriver) would be fairly typical, but is it?
Thanks for any tips, especially coming from your actual setup that actually works for sure. :)
5
u/Professional_Mix2418 Jun 22 '26
I’ve stopped using the chromedriver as like on macOS golden gate where SIP is enforced it started to annoy me even more. I had to manually approach the chromedrive.
So I switched to capybara with cuprite. My Claude cli happily runs that no problem. And it can also use that to “look at the website directly”. Pretty awesome.
Also last week week turned to running rspec in parallel. It’s nice and fast and I am no longer the choke point.
1
u/jrochkind Jun 22 '26
More -- apparently other people don't have ths problem at all, their claude code can jsut run chromedriver just fine? WEIRD.
I am not sure how to explain exactly what the problem is, because it is kind of hidden inside claude?
But okay, here's a copy pasted claude code session showing one phase of it.
What it specifically mentions about writing to user directory might seem like an easy to solve problem (tell chrome to put it's user directory inside the sandbox), but believe me 've spent all day on this. if I go down the path of trying to solve it in dialog with claude, it never actually gets solved, I just go back and forth iwth my settings.json getting increasingly complicated, but never get to the point I can run the specs.
Really nobody else ran into this, your claude can just run chromedriver specs off the bat? Do you have
"sandbox": { "enabled": true}in your settings.json? Maybe just none of y'all are actually using the sandbox at all? (Which would be good info for me!)Here is my current
.claude/settings.jsonI wonder if it's just that none of the rest of y'all are running with sandbox enabled? (This is what claude itself started me out with, and it seems wise to me to use the sandbox?)
I'm not necesarily looking for more troubleshooting advice from someone who has never seen this problem, I've probably tried what you will suggest... I thought it was something everyone must know about and had figured out a way around... I'm very confused now if everybody else is having claude code run chromedriver just fine, and it's just me! Why would my claude code and rails app be different than anyone else's?
I am more looking for info on what does work for you... if anyone can confirm that their claude code is capable of running capybara/selenium/chromedriver specs, and is willing to share all or part of their
.claude/settings.jsonand/or arguments to set up the chrome driver for capybara, that might be helpful?-1
u/armahillo Jun 22 '26
Can you elaborate on why you want claude to do that?
Are you just needing the specs to be run automatically or is there a specific thing you need claude to do?