I use rspec 3.9, capybara 3.16 and selenium-webdriver 3.141 with chrome 73 to test a large web application. I have a lot of feature specs and sooner or later chrome becomes unresponsive, I can see the window open but nothing happening. This happens in headless mode too. There's no pattern to this, it just happens at random.
Failure/Error: example.run Selenium::WebDriver::Error::WebDriverError: chrome not reachable (Session info: chrome=73.0.3683.86) (Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Linux 3.10.0-1062.12.1.el7.x86_64 x86_64) I'd like to do something like:
config.after(:each, type: :feature) do |example| if example.exception # restart chrome! end end In combination with rspec-repeat, this will try up to 3 times. But I'm not sure how to restart the browser.
Does anyone know how to do this?