Skip to content

Instantly share code, notes, and snippets.

@liamness
Created October 24, 2018 19:12
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liamness/4e9ded403b419e33071be0e9b6e3f7d2 to your computer and use it in GitHub Desktop.
Save liamness/4e9ded403b419e33071be0e9b6e3f7d2 to your computer and use it in GitHub Desktop.
/*
Google currently don't offer a way to easily delete all the passwords that you have saved with them.
So if you need to do that, here is a thing that does that.
Just browse to passwords.google.com, log in, and paste the following into the console.
Of course, posting things you found on the internet into the console is usually a bad idea.
*/
(() => {
let currentButton
const intervalId = setInterval(() => {
const button = document.querySelector('div[aria-label^="Remove "]')
if (!button) {
console.log('Nothing more to delete, woo');
clearInterval(intervalId);
} else if (button === currentButton) {
console.log('Do nothing, still deleting current password');
} else {
console.log(`Deleting ${button.parentElement.parentElement.textContent}...`);
currentButton = button
button.click();
}
}, 200);
})();
@macariojames
Copy link

Thanks for this! Found it on your reddit post. For you or anyone else who cares, i personally added 2 lines to the top to let me know how many passwords this script would be deleting. It's below:


(() => {
  passwordCount = document.querySelectorAll('div[aria-label^="Remove "]').length
  console.log('Total passwords to delete: '+passwordCount)

  let currentButton

  const intervalId = setInterval(() => {
    const button = document.querySelector('div[aria-label^="Remove "]')

    if (!button) {
      console.log('Nothing more to delete, woo');
      clearInterval(intervalId);
    } else if (button === currentButton) {
      console.log('Do nothing; still deleting current password');
    } else {
      console.log(`Deleting ${button.parentElement.parentElement.textContent}...`);   
      currentButton = button
      button.click();
    }
  }, 200);
})();

@HaleTom
Copy link

HaleTom commented Mar 2, 2024

This doesn't work for me at https://passwords.google.com/

@liamness
Copy link
Author

liamness commented Mar 4, 2024

It's been ages since I wrote this script, probably the markup changed in the meantime. You can also remove all your passwords by deleting them in Chrome's settings, and then syncing the changes.

@paciook
Copy link

paciook commented Apr 10, 2024

This doesn't work for me at https://passwords.google.com/

@HaleTom

The quickest way I found to delete all passwords in chrome was to run a little script performing a sequence of mouse clicks... super sketchy but handy.

#!/bin/bash

i=$1
interval=$2

while [ $i -gt 0 ]
do
    sleep $interval


    xdotool mousemove <replace_with_x1> <replace_with_y1>
    xdotool click 1

    sleep $interval

    xdotool mousemove <replace_with_x2> <replace_with_y2>
    xdotool click 1

    i=$[i-1]
done

You should have xdotool installed.

To run it:

  1. Go to chrome://password-manager/passwords
  2. Set your cursor over the first password and run xdotool getmouselocation. That should output something like x:895 y:352 .... That's your x1 and y1 respectively.
  3. Click that password and set your cursor over the "Delete" button and run xdotool getmouselocation again. That's your x2 and y2 respectively.
  4. Once you replace all 4 placeholers, run bash this_script.sh i interval replacing i with the number of passwords you have, and interval with the ammount of seconds you want to wait between each click. Ex: bash this_script.sh 10 0.2

I'm not proud of this approach but I don't need anything fancy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment