In Our application while testing Manually we clear Cookies (Ctrl+Shift+Del), How can I automate this step?
Note: We are using Java
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It only takes a minute to sign up.
Sign up to join this communityYou can delete cookies using cookiename and all cookies alltogether.
To delete a particular cookie , use this
driver.manage().deleteCookieNamed(cookiename);
Python version of this method is
driver.delete_cookie(cookiename)
To delete all cookies at once
driver.manage().deleteAllCookies();
Python version for the same above is
driver.delete_all_cookies()
These are same for all browsers.
deleteAllCookies
will only delete cookies under the domain of currently opened page.
Jan 3, 2017 at 7:36
You can use Selenium methods to clear the cookies.Here is the example
driver.manage().deleteAllCookies();