In Our application while testing Manually we clear Cookies (Ctrl+Shift+Del), How can I automate this step?

Note: We are using Java

2 Answers 2


You can delete cookies using cookiename and all cookies alltogether.

To delete a particular cookie , use this


Python version of this method is


To delete all cookies at once


Python version for the same above is


These are same for all browsers.

  • A small warning is that these look like non blocking methods - stackoverflow.com/questions/27504358/…
    – John
    Nov 21, 2016 at 13:51
  • Also, deleteAllCookies will only delete cookies under the domain of currently opened page. Jan 3, 2017 at 7:36
  • @KenstonChoi Yes, right!! How to delete from other domains as well?? Apr 7, 2017 at 9:10
  • @Pranav-BitWiser, some sites suggest that the browser has to visit these domains individually and delete the cookies. The easiest is to just launch a new browser session. Apr 7, 2017 at 11:07
  • @KenstonChoi Does this means that launching a new session will automatically deletes all cookies? Apr 7, 2017 at 13:25

You can use Selenium methods to clear the cookies.Here is the example

  • Is this Same for all Browsers? Feb 15, 2016 at 7:21
  • 1
    yup, same for all for browsers
    – QAMember
    Feb 15, 2016 at 7:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.