Cookies

 1. What are the means of browser cookies?

  1. They are small blocks of codes stored inside our computer by other websites. 
  2. It stores information like username and other session details etc…
  3.  We can see saved cookies under the Application tab in the inspect mode of the browser.

2. What are the methods related to cookies in selenium?

  1. getCookies(): This retrieved all the cookies of the current domain 
  2. getCookieNamed() : Retrive a cookie by name
  3. addCookie(): Add a new cookie or update an existing one (Cookie object is needed)
  4. deleteCookieNamed(String name): Delete a cookie by name
  5. deleteCookie(Object): Delete specific cookie (Need cookie object here)
  6. deleteAllCookies(): Delete all the cookies
Cookie cookieToDelete = new Cookie("cookieName", "cookieValue");
driver.manage().deleteCookie(cookieToDelete);
driver.manage().deleteCookieNamed("cookieName");

No comments:

Post a Comment

Cucumber

What is Cucumber? Definition : Cucumber is an open-source tool that supports BDD . Purpose : Bridges the communication gap between business ...