How to add cookies with ruby Capybara
Way back I wrote an article how to add cookies with selenium webdriver , many people asked How to add cookies with ruby Capybara. So here we go … Before we get started lets just have a quick recap about what is a http cookie :
An HTTP cookie (also called web cookie, Internet cookie, browser cookie, or simply cookie) is a small piece of data sent from a website and stored on the user’s computer by the user’s web browser while the user is browsing
The questions is , why do you need to even touch this part ? Well image you have a cookie banner on the website you are testing and thats annoyingly following your selenium tests everywhere around and sometimes you get element is not clickable at point error . Given the fact that most of our tests doesn’t really care about that cookie banner you can actually pre-set a cookie value before you start your tests and you get read if it.
And how to use the method :