From 0ccf1dbb39e7891a4ac9b8f0d1e75c6be14fa815 Mon Sep 17 00:00:00 2001 From: qcrao Date: Fri, 20 Oct 2023 14:55:52 +0800 Subject: [PATCH] [commission]fix delete button bug with delay --- bulkDeleteConversations.js | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/bulkDeleteConversations.js b/bulkDeleteConversations.js index ae42dfc..357243c 100644 --- a/bulkDeleteConversations.js +++ b/bulkDeleteConversations.js @@ -7,29 +7,10 @@ async function bulkDeleteConversations() { return; } - for (let i = 0; i < selectedConversations.length; i++) { - const element = selectedConversations[i]; - const deleteButton = element.querySelector(Selectors.deleteButton); - - // If it is the first conversation and there is a delete button, skip it - if (i === 0 && deleteButton) { - console.log("Skipping first conversation due to existing delete button."); - continue; - } - - // If it's not the first conversation but has a delete button, remove it - if (i !== 0 && deleteButton) { - console.log("delete the delete button."); - deleteButton.remove(); - break; - } - } - console.log("Selected Conversations:", selectedConversations); for (const element of selectedConversations) { await deleteConversation(element); - await delay(300); } } @@ -47,6 +28,7 @@ async function deleteConversation(checkbox) { console.log("1. Clicking conversation", conversationElement); conversationElement.click(); + await delay(300); const deleteButton = await waitForElement(Selectors.deleteButton);