Skip to content

Instantly share code, notes, and snippets.

@Ardesco
Created November 12, 2012 22:45
Show Gist options
  • Save Ardesco/4062573 to your computer and use it in GitHub Desktop.
Save Ardesco/4062573 to your computer and use it in GitHub Desktop.
Safari Driver Patch To Remove All Cookies
/** Deletes all cookies visible to the current page. */
safaridriver.inject.commands.deleteCookies = function() {
var keys = goog.net.cookies.getKeys();
var domain = document.domain;
for (var i = keys.length - 1; i >= 0; i--) {
goog.net.cookies.remove(keys[i], "/", domain);
}
};
/**
* Deletes a specified cookie.
* @param {!safaridriver.Command} command The command object.
*/
safaridriver.inject.commands.deleteCookie = function(command) {
var domain = document.domain;
goog.net.cookies.remove((/** @type {string} */command.getParameter('name')), "/", domain);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment