Skip to content

Instantly share code, notes, and snippets.

@yilmazdurmaz
Created December 30, 2021 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yilmazdurmaz/01e4d205bf3d5b95c03f0bb8dfaee18b to your computer and use it in GitHub Desktop.
Save yilmazdurmaz/01e4d205bf3d5b95c03f0bb8dfaee18b to your computer and use it in GitHub Desktop.
clear browser history in history page
// open history page of the browser
// open dev tools and get to console
// set sleep function and the use for loop
// change "getelements..." queries if needed
// note that it is not intended to clear thing other than history
// sleep function from https://stackoverflow.com/a/951057/9512475
// sleep time expects milliseconds
function sleep (time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
// Usage!
sleep(500).then(() => {
// Do something after the sleep!
})
// deletion is not automated.
// history page store only around 10 elements at time.
// and this can delete up to 100 entries at a time
// so repeat the command until history is clear
for(x=0;x<10;x++){
sleep(x*250).then(()=>{
for(i=10;i>0;i--){
document.getElementsByTagName("input")[i].click();
}
document.getElementById("actionDialogCardPrimaryButton").click();
document.getElementById("confirmModalPrimaryButton").click();
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment