- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are the different cookies methods in Selenium?
The different cookies method in Selenium are listed below −
driver.manage().deleteAllCookies() − This removes all cookies.
driver.manage().deleteCookie(Id) − This removes a particular cookie.
driver.manage().deleteCookieNamed(CookieName) − This removes a particular cookie based on Name.
driver.manage().getCookies() − This returns all the cookies.
driver.manage().getCookieNamed(CookieName) − This returns a particular cookie based on Name.
driver.manage().addCookie(Id) − This adds a particular cookie.
Code Implementation with some cookies method.
Example
import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class CookiesScripting { public static void main(String[] args) { // TODO Auto-generated method stub System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); // deleting all the cookies driver.manage().deleteAllCookies(); // delete a cookie of name sessionId driver.manage().deleteCookieNamed("sessionid"); String url = "https://www.tutorialspoint.com/index.htm"; driver.get(url); driver.manage().window().maximize(); driver.close(); } }
- Related Articles
- What are the different methods of contraception?
- What are different selenium versions?
- What are different hashing methods in DBMS?
- What are different Navigator methods available?
- What are different methods of weeding?
- What are different data conversion methods in Python?
- What are the various methods available under Select class in Selenium?
- What are the different types of wait available in Selenium?
- What are Cookies?
- What are different methods of passing parameters in C#?
- What are different methods to implement rename buffers?
- What are the different methods of creating a css expression?
- What are cookies in JavaScript?
- What are cookies in JSP?
- What are the differences between close() and quit() methods in Selenium with python?

Advertisements