1. What are the means of browser cookies?
- They are small blocks of codes stored inside our computer by other websites.
- It stores information like username and other session details etc…
- 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?
- getCookies(): This retrieved all the cookies of the current domain
- getCookieNamed() : Retrive a cookie by name
- addCookie(): Add a new cookie or update an existing one (Cookie object is needed)
- deleteCookieNamed(String name): Delete a cookie by name
- deleteCookie(Object): Delete specific cookie (Need cookie object here)
- deleteAllCookies(): Delete all the cookies
Cookie cookieToDelete = new Cookie("cookieName", "cookieValue");
driver.manage().deleteCookie(cookieToDelete);
driver.manage().deleteCookieNamed("cookieName");
No comments:
Post a Comment