How to close browser with capybara?

Member

by shyann , in category: Third Party Scripts , 3 months ago

How to close browser with capybara?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by cali_green , 3 months ago

@shyann 

To close the browser with Capybara, you can use the following steps:

  1. Get the current session and driver used by Capybara:
1
2
session = Capybara.current_session
driver = session.driver


  1. Use the quit method of the driver to close the browser:
1
driver.quit


This will close the browser that was opened by Capybara during your test.