Skip to content

Instantly share code, notes, and snippets.

@sincerekamal
Last active June 7, 2018 05:44
Show Gist options
  • Save sincerekamal/2c8b55a66e77d898c4f7 to your computer and use it in GitHub Desktop.
Save sincerekamal/2c8b55a66e77d898c4f7 to your computer and use it in GitHub Desktop.
Clear Chrome: browser history in the current view
(() => {
var ele = document.querySelector('history-app');
var historyItems = ele.shadowRoot.querySelector('history-list').shadowRoot.querySelector('iron-list').querySelectorAll('history-item');
historyItems.forEach((item) => { item.shadowRoot.querySelector('#checkmark').click(); });
ele.shadowRoot.querySelector('history-toolbar').shadowRoot.querySelector('cr-toolbar-selection-overlay').shadowRoot.querySelector('#delete').click();
var btnCont = ele.shadowRoot.querySelector('history-list').shadowRoot.querySelector('dialog').shadowRoot.children[3].querySelector('content[name="button-container"]');
btnCont.getDistributedNodes()[0].querySelector('.action-button').click();
})()
@sincerekamal
Copy link
Author

sincerekamal commented Mar 14, 2015

If you want to clear history having specific words, follow the steps

  1. Search for the words in the history search bar
  2. Run the script now ;)

This above script tested in Chrome v66.

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