Skip to content

Instantly share code, notes, and snippets.

@wilhelm-murdoch
Last active October 31, 2025 12:44
Show Gist options
  • Select an option

  • Save wilhelm-murdoch/6965a9cf9a36c9067745d9f53fe8cc4c to your computer and use it in GitHub Desktop.

Select an option

Save wilhelm-murdoch/6965a9cf9a36c9067745d9f53fe8cc4c to your computer and use it in GitHub Desktop.
// --- Session Auto-Clicker Utility ---
// This script is designed to run in the browser's Developer Tools Console.
// It searches for a button with the exact text content "Start session" every second (1000ms).
let clickerInterval = null;
const targetText = "Start session";
const intervalMs = 1000;
/**
* Searches the DOM for a button with the target text content and clicks it.
* Stops the interval upon a successful click to prevent unintended multiple actions.
*/
function attemptClick() {
// Look for all button elements on the page
const buttons = document.querySelectorAll('button');
// Iterate over the buttons to find the one with the exact text
for (const button of buttons) {
// Use trim() to handle potential leading/trailing whitespace
if (button.textContent.trim() === targetText) {
console.log(`[AutoClicker] Found button with text "${targetText}". Clicking now...`);
// Simulate a click event
button.click();
// Stop the clicker after a successful interaction
stopSessionClicker();
return; // Exit the function after the click
}
}
console.log(`[AutoClicker] Button not found. Retrying in ${intervalMs / 1000} second(s).`);
}
/**
* Starts the interval to check for the button every second.
*/
function startSessionClicker() {
if (clickerInterval) {
console.warn("[AutoClicker] Clicker is already running. Stop it first using stopSessionClicker().");
return;
}
console.log(`[AutoClicker] Starting to watch for button "${targetText}" every ${intervalMs}ms.`);
// Set up the interval timer
clickerInterval = setInterval(attemptClick, intervalMs);
}
/**
* Stops the running interval.
*/
function stopSessionClicker() {
if (clickerInterval) {
clearInterval(clickerInterval);
clickerInterval = null;
console.log("[AutoClicker] Clicker stopped.");
} else {
console.log("[AutoClicker] Clicker is not currently running.");
}
}
// --- INITIALIZATION ---
console.log("--- Session Auto-Clicker Utility Loaded ---");
console.log(`Call \`startSessionClicker()\` to begin watching for the button "${targetText}".`);
console.log(`Call \`stopSessionClicker()\` to manually stop the process.`);
// Automatically start the utility for convenience
startSessionClicker();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment