I'd like to delete the cookies for specific websites in Safari. I found an example here from four or five years ago that used AppleScript that no longer worked, but I tinkered with it a bit and almost got it working, but now the upgrade to Ventura seems to have broken it completely.
Does anyone have a solution for deleting specific cookies from Safari?
on run
set theQuery to "{query}"
tell application "System Events" to tell application process "Safari"
set frontmost to true
keystroke "," using command down
delay 1
tell window 1
click button "Privacy" of toolbar 1 of it
click button "Manage Website Data…" of group 1 of group 1
delay 3
keystroke theQuery
try
set sitename to get name of UI element 1 of row 1 of table 1 of scroll area 1 of sheet 1
select row 1 of table 1 of scroll area 1 of sheet 1
click button "Remove" of sheet 1
click button "Done" of sheet 1
keystroke "w" using command down
on error errmsg number errnbr
click button "Done" of sheet 1
keystroke "w" using command down
--display alert "No cookies to remove" giving up after 5
return theQuery & ": No Cookies found"
end try
end tell
end tell
return sitename & ": Cookies Removed"
--return theQuery
end run