Skip to content

Instantly share code, notes, and snippets.

@JKamsker
Created September 8, 2025 10:10
Show Gist options
  • Save JKamsker/ab9e67dc865d8a3da1d3d46e48514e5f to your computer and use it in GitHub Desktop.
Save JKamsker/ab9e67dc865d8a3da1d3d46e48514e5f to your computer and use it in GitHub Desktop.
Delete all Google Jules Tasks
/**
* This script automates the process of deleting ALL tasks, starting from the last one.
* It is designed to be run in the browser's developer console.
*/
async function deleteAllTasksReverse() {
// 1. Find all task options buttons.
const allOptionsButtons = document.querySelectorAll("swebot-task-tile > swebot-task-options > button");
if (allOptionsButtons.length === 0) {
console.log("No tasks found to delete.");
return;
}
console.log(`Found ${allOptionsButtons.length} tasks. Starting deletion from last to first.`);
// 2. Loop through the buttons in reverse order (from last to first).
for (let i = allOptionsButtons.length - 1; i >= 0; i--) {
const optionsButton = allOptionsButtons[i];
const taskNumber = i + 1;
console.log(`--- Processing Task #${taskNumber} ---`);
if (!optionsButton) {
console.error(`Error: Could not find the options button for task #${taskNumber}. Skipping.`);
continue;
}
// Step A: Click the options button to open the menu
console.log(`Step 1: Clicking options for task #${taskNumber}...`);
optionsButton.click();
await new Promise(resolve => setTimeout(resolve, 500)); // Wait for context menu
// Step B: Find and click the "Delete" button in the context menu
const allMenuButtons = document.querySelectorAll('.cdk-overlay-pane button.cdk-menu-item');
const deleteButton = Array.from(allMenuButtons).find(btn => btn.textContent.trim() === 'Delete');
if (!deleteButton) {
console.error(`Error: Could not find 'Delete' button for task #${taskNumber}. Skipping.`);
// Attempt to close the menu by simulating an escape key press or clicking elsewhere might be needed if script hangs
continue;
}
console.log(`Step 2: Clicking 'Delete' for task #${taskNumber}...`);
deleteButton.click();
await new Promise(resolve => setTimeout(resolve, 500)); // Wait for confirmation modal
// Step C: Find and click the final "Delete" button in the confirmation dialog
const confirmDeleteButton = document.querySelector("swebot-delete-dialog .delete-button");
if (!confirmDeleteButton) {
console.error(`Error: Could not find final 'Delete' confirmation for task #${taskNumber}. Skipping.`);
continue;
}
console.log(`Step 3: Confirming deletion for task #${taskNumber}...`);
confirmDeleteButton.click();
console.log(`--- Task #${taskNumber} deletion confirmed. ---`);
// Step D: Wait a moment for the UI to update before processing the next task.
await new Promise(resolve => setTimeout(resolve, 1000));
}
console.log("Process complete: All tasks have been processed.");
}
// Execute the function.
deleteAllTasksReverse();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment