google-photos-delete-tool icon indicating copy to clipboard operation
google-photos-delete-tool copied to clipboard

Need to manually click delete button each time

Open suppafly19 opened this issue 11 months ago • 6 comments

Great script! I'm seeing that after it runs the select on all of the photos, you get a prompt in the corner asking you to delete. If you don't manually click on delete it then just unselecting everything after a few seconds and does the same again in a cycle. If it was possible for it to select and click the button too so the process could be fully automated and left to run by itself

suppafly19 avatar Mar 07 '24 22:03 suppafly19

The selector for the confirmation button has changed. You can try the following method. If this doesn't work, you must obtain the selector from the button manually. To do this, go to the Elements tab in the developer tools, select the confirmation button when it appears, highlight the HTML of the button, right-click, and choose "Copy selector". ~Good Luck!

const ELEMENT_SELECTORS = { checkboxClass: '.ckGgle', languageAgnosticDeleteButton: 'div[data-delete-origin] button', deleteButton: 'button[aria-label="Delete"]', confirmationButton: '#yDmH0d > div.VfPpkd-Sx9Kwc.cC1eCc.UDxLd.PzCPDd.V639qd.bvQPzd.oEOLpc.A9Uzve.VfPpkd-Sx9Kwc-OWXEXe-FNFY6c > div.VfPpkd-wzTsW.O4g5Md.iWO5td > div > div.VfPpkd-cnG4Wd.m5OsGf > div > div.VfPpkd-T0kwCb.IdSMxc > button.VfPpkd-LgbsSe.VfPpkd-LgbsSe-OWXEXe-k8QpJ.nCP5yc.AjY5Oe.LQeN7.kDryjd' }

jwsims avatar Mar 13 '24 01:03 jwsims

I just made a PR to fix this. :)

caelchristian avatar Mar 22 '24 18:03 caelchristian

Thank you that worked for me, appreciate it!

Here is the changed console code to copy & paste (in case someone doesn't understand what to do with the above code)

https://pastebin.com/gemQ7wnX

kiwijunglist avatar Apr 27 '24 23:04 kiwijunglist

FYI. the following confirmation button selector worked for me today confirmationButton: '#yDmH0d > div.VfPpkd-Sx9Kwc.cC1eCc.UDxLd.PzCPDd.V639qd.oEOLpc.A9Uzve.VfPpkd-Sx9Kwc-OWXEXe-FNFY6c > div.VfPpkd-wzTsW.O4g5Md.iWO5td > div > div.VfPpkd-cnG4Wd.m5OsGf > div > div.VfPpkd-T0kwCb.IdSMxc > button.VfPpkd-LgbsSe.VfPpkd-LgbsSe-OWXEXe-k8QpJ.nCP5yc.AjY5Oe.LQeN7.kDryjd'

Xorboo avatar May 13 '24 22:05 Xorboo

FYI. the following confirmation button selector worked for me today confirmationButton: '#yDmH0d > div.VfPpkd-Sx9Kwc.cC1eCc.UDxLd.PzCPDd.V639qd.oEOLpc.A9Uzve.VfPpkd-Sx9Kwc-OWXEXe-FNFY6c > div.VfPpkd-wzTsW.O4g5Md.iWO5td > div > div.VfPpkd-cnG4Wd.m5OsGf > div > div.VfPpkd-T0kwCb.IdSMxc > button.VfPpkd-LgbsSe.VfPpkd-LgbsSe-OWXEXe-k8QpJ.nCP5yc.AjY5Oe.LQeN7.kDryjd'

Thank you. This change worked for me. Here is the full code with this fix: https://pastebin.com/5KKmmKMt

csBlackWolf avatar May 17 '24 03:05 csBlackWolf

How about something more elegant like

buttons.confirmation_button = Array.from(document.querySelectorAll('button')).find(button => button.textContent.trim() === 'Move to trash');

English version of the site is already required so why not

Lyapsus avatar May 17 '24 19:05 Lyapsus