Submitted by harrydev on Sat, 02/15/2014 - 13:44
Delete Cookie with Name
Delete All Cookies
User can delete a cookie from the browser's "cookie jar". The domain of the cookie will be ignored.
User can delete the named cookie from the current domain. This is equivalent to setting the named cookie's expiry date to sometime in the past.
User can also delete all the cookies for the current domain using driver.manage().deleteAllCookies();
Deleting the specific cookie with cookie name "--utmb"
Submitted by harrydev on Sat, 02/15/2014 - 09:25
Using webdriver we can easily pass the cookie to the domain. In order to pass cookie, we should use a method named "addCookie(cookie)"
Method Name: addCookie(Cookie cookie)
Purpose: To add a specific cookie into cookies. If the cookie's domain name is left blank, it is assumed that the cookie is meant for the domain of the current document.
Parameters: cookie - The name and value of the cookie to be add.
Submitted by harrydev on Sat, 02/15/2014 - 08:42
Selenium webdriver can perform required task with respect to browser cookies. We add , delete, delete particular cookie by passing the name, and so on. Let us look all of the in details.
First let us see how add cookie works: