How to test Cookies with Selenium WebDriver
By: Slav Kurochkin
Here is a screenshot how you can inspect cookies in Chrome developer tool
How to delete cookie on with webdriver?
// delete all cookie driver.manage().deleteAllCookies(); Cookie cookie = driver.manage().getCookieNamed("SomeCookieName"); driver.manage().deleteCookie(cookie); // delete cookie named driver.manage().deleteCookieNamed("");
How to get cookie so you can assert it later on
// Get cookie named Cookie cookie = driver.manage().getCookieNamed("SomeCookieName"); // Get all cookies driver.manage().getCookies();
How to send cookies with selenium webdriver?
Cookie cookie = new Cookie("name", "value"); driver.manage().addCookie(cookie);
For more information An interface for managing stuff you would do in a browser menu