Skip to content

Instantly share code, notes, and snippets.

@miszo
Created August 3, 2020 11:28
Show Gist options
  • Save miszo/0caacb8511270c816a34da6c2c05b4c0 to your computer and use it in GitHub Desktop.
Save miszo/0caacb8511270c816a34da6c2c05b4c0 to your computer and use it in GitHub Desktop.
Unfortunately it is impossible to clear all passwords at one in Chrome. But since it is written with web technologies, you can navigate through DOM and ShadowDOM. It works with Chrome v84.
// Unfortunately it is impossible to clear all passwords at one in Chrome.
// But since it is written with web technologies, you can navigate through DOM and ShadowDOM.
// It works with Chrome v84.
// 1. Go to chrome://settings/passwords
// 2. Open console, paste code below or run it as a snippet in devtools
(() => {
const interval = setInterval(() => {
const kebabMenu = document.querySelector('settings-ui').shadowRoot.children.container.querySelector('settings-main').shadowRoot.querySelector('settings-basic-page').shadowRoot.querySelector('#basicPage settings-autofill-page').shadowRoot.querySelector('#pages settings-subpage #passwordSection').shadowRoot.querySelector('#passwordList').querySelector('password-list-item').shadowRoot.querySelector('cr-icon-button#passwordMenu');
const removePasswordButton = document.querySelector('settings-ui').shadowRoot.children.container.querySelector('settings-main').shadowRoot.querySelector('settings-basic-page').shadowRoot.querySelector('#basicPage settings-autofill-page').shadowRoot.querySelector('#pages settings-subpage #passwordSection').shadowRoot.querySelector('#menu #menuRemovePassword');
kebabMenu.click();
removePasswordButton.click();
}, 200);
const whenShouldStopInterval = 60 * 1000;
setTimeout(() => clearInterval(interval), whenShouldStopInterval);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment