Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to delete all cookies of current domain in Selenium webdriver

I am working on Selenium webDriver in which I am using the method driver.manage().deleteAllCookies(); But this method is deleting all cookies from the current domain except one. Strange!!

I am using Chrome right now.

Can anyone suggest what could be the possible cause and what we can do to delete all cookies for the current domain?

like image 718
Nikunj Aggarwal Avatar asked Oct 27 '25 12:10

Nikunj Aggarwal


1 Answers

driver.manage().deleteAllCookies();

This will only delete cookies on current domain. It won't delete cookies of any other domain.

So if you need to delete cookies of those domain then you need to first browse to a page from that domain and then call the deleteAllCookies method again

like image 69
Tarun Lalwani Avatar answered Oct 29 '25 04:10

Tarun Lalwani