Elsa Speech Analyzer Recordings DELETE single

 avatar
Andy
javascript
a month ago
1.4 kB
3
Indexable
Never
(async () => {
    // Selector for the delete icon using the class 'elsa-icon-delete recording-item__action-icon'
    const DELETE_ICON_SELECTOR = '.elsa-icon-delete.recording-item__action-icon';
    // Selector for the confirmation button ('Yes') in the pop-up
    const CONFIRM_BUTTON_SELECTOR = '.btn.recording-popup-confirm__ok';

    // Helper function to wait for a given time (used for delays)
    const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));

    // Step 1: Select the delete icon using the selector
    const deleteIcon = document.querySelector(DELETE_ICON_SELECTOR);

    // Step 2: Check if the delete icon was found and click it
    if (deleteIcon) {
        deleteIcon.click();
        console.log('Delete icon clicked.');

        // Wait for the pop-up to appear
        await sleep(500); // You can adjust the time as needed based on the delay for the pop-up

        // Step 3: Select the confirmation button
        const confirmButton = document.querySelector(CONFIRM_BUTTON_SELECTOR);

        // Step 4: Check if the confirmation button was found and click it
        if (confirmButton) {
            confirmButton.click();
            console.log('Confirmation button clicked.');
        } else {
            console.log('No confirmation button found.');
        }
    } else {
        console.log('No delete icon found.');
    }
})();
Leave a Comment