add delay after click delete button

This commit is contained in:
qcrao
2023-10-12 18:12:19 +08:00
parent 2a598ec8e6
commit 42fc405595
2 changed files with 3 additions and 4 deletions

View File

@@ -11,7 +11,6 @@ async function bulkDeleteConversations() {
// 使用 for 循环按顺序删除选中的对话 // 使用 for 循环按顺序删除选中的对话
for (const element of selectedConversations) { for (const element of selectedConversations) {
await delay(300);
await deleteConversation(element); await deleteConversation(element);
} }
} }
@@ -28,7 +27,7 @@ function removeAllCheckboxes() {
async function deleteConversation(checkbox) { async function deleteConversation(checkbox) {
const conversationElement = await checkbox.closest('.flex.p-3.items-center.gap-3.relative.rounded-md') const conversationElement = await checkbox.closest('.flex.p-3.items-center.gap-3.relative.rounded-md')
console.log("1. 开始删除", conversationElement); console.log("1. 点击对话", conversationElement);
conversationElement.click(); // 点击对话 conversationElement.click(); // 点击对话
// debugger // debugger
@@ -36,10 +35,10 @@ async function deleteConversation(checkbox) {
const deleteButton = await waitForElement("nav div a>div>button:nth-child(2)"); const deleteButton = await waitForElement("nav div a>div>button:nth-child(2)");
if (deleteButton) { if (deleteButton) {
await delay(100);
console.log("2. 点击删除按钮"); console.log("2. 点击删除按钮");
deleteButton.click(); // 点击删除按钮 deleteButton.click(); // 点击删除按钮
await delay(300);
// 等待确认删除对话框的按钮出现 // 等待确认删除对话框的按钮出现
const confirmButton = await waitForElement('button.btn.btn-danger'); const confirmButton = await waitForElement('button.btn.btn-danger');

View File

@@ -1,7 +1,7 @@
{ {
"manifest_version": 3, "manifest_version": 3,
"name": "ChatGPT Bulk Delete", "name": "ChatGPT Bulk Delete",
"version": "2.7", "version": "2.8",
"description": "A Chrome extension to bulk delete ChatGPT conversations", "description": "A Chrome extension to bulk delete ChatGPT conversations",
"icons": { "icons": {
"48": "icon48.png" "48": "icon48.png"