Skip to content

Instantly share code, notes, and snippets.

@danromero
Created July 24, 2023 16:55
Show Gist options
  • Save danromero/91cf2aa3a4d4dd6fe4c6f8ecd0adc8d3 to your computer and use it in GitHub Desktop.
Save danromero/91cf2aa3a4d4dd6fe4c6f8ecd0adc8d3 to your computer and use it in GitHub Desktop.
repeat 10 times
tell application "Google Chrome" to tell active tab of window 1
-- Click the "More" button
execute javascript "document.querySelector('div[role=\"button\"][aria-label=\"More\"]').click();"
delay 0.1
-- Click the "Delete conversation" button
execute javascript "Array.from(document.querySelectorAll('div[role=\"menuitem\"]')).find(el => el.innerText.includes('Delete conversation')).click();"
delay 0.1 -- You might need to adjust this delay based on the page's behavior
-- Click the "Leave" confirmation button
execute javascript "document.querySelector('div[data-testid=\"confirmationSheetConfirm\"]').click();"
delay 0.1 -- This delay ensures there's enough time for each action to complete
end tell
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment