Browser Cookies and Windows Command

HTTP Cookie is also called a web cookie, a browser cookie, or an Internet cookie. A cookie is a small piece of data that is sent from a website and stored in your computer. Cookies are mostly used to recognize the user and load the stored information. So basically, it is comprised of information about the user and their preferences.

Selenium web driver can perform the required task with respect to browser cookies

1. Get Cookies

This method is used to get all the list of cookies stored in the web browser.


2. Add Cookie

This method is used to add a specific cookie into cookies. If the cookie’s domain name is left blank, then cookie is assumed to be domain of the current document.

Cookie name = new Cookie(“cookie”, “12345678”);

3. Get Cookie Named

This method is used to get a cookie of the specific name.


4. Delete Cookie Named

This method is used to delete the cookie of specific name from the current browsing domain.


5. DeleteAllCookies

This method is used to deletes all the cookies of the current browsing domain.