← back to Norma
Fix IG delete: target the Delete BUTTON, not the 'Delete post?' heading
8417463cca03564421847ba5cbaf54ecb4680ef7 · 2026-08-17 12:48:52 -0700 · Steve Abrams
The confirm dialog renders a heading 'Delete post? Are you sure...' whose ref
matched the broad /Delete/ selector BEFORE the actual Delete button, so the
script clicked a no-op heading ('clicked but not verified gone') and nothing
deleted. Now matches button "More options" / button "Delete" specifically.
Proven: @ffepurchasing 3/3 deleted + verified gone.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Files touched
M agents/instagram-agent/delete-originals.js
Diff
commit 8417463cca03564421847ba5cbaf54ecb4680ef7
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Mon Aug 17 12:48:52 2026 -0700
Fix IG delete: target the Delete BUTTON, not the 'Delete post?' heading
The confirm dialog renders a heading 'Delete post? Are you sure...' whose ref
matched the broad /Delete/ selector BEFORE the actual Delete button, so the
script clicked a no-op heading ('clicked but not verified gone') and nothing
deleted. Now matches button "More options" / button "Delete" specifically.
Proven: @ffepurchasing 3/3 deleted + verified gone.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
agents/instagram-agent/delete-originals.js | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/agents/instagram-agent/delete-originals.js b/agents/instagram-agent/delete-originals.js
index 88f37a6..e75e2e0 100644
--- a/agents/instagram-agent/delete-originals.js
+++ b/agents/instagram-agent/delete-originals.js
@@ -102,10 +102,10 @@ async function seesText(re, { tries = 3, settleMs = 800 } = {}) {
// Is this post owned by the currently-logged-in account? (Delete affordance reachable.)
async function isDeletable() {
- const opened = await clickByText(/More options|More$/i);
+ const opened = await clickByText(/button "More options"/i);
if (!opened) return { deletable: false, reason: 'no ··· menu (not logged in / not painted)' };
await sleep(1500);
- const del = await seesText(/\bDelete\b/);
+ const del = await seesText(/button "Delete"/i);
// close the menu without acting (Escape) when only probing
try { oc(`press Escape --target-id ${tab}`); } catch { /* ignore */ }
return del ? { deletable: true } : { deletable: false, reason: 'no Delete item (not owner of this account)' };
@@ -114,13 +114,13 @@ async function isDeletable() {
async function deleteOne(r) {
navigate(r.old_permalink); await sleep(2800);
// open the ··· menu (retry-tolerant against the snapshot→click stale-ref race)
- if (!await clickByText(/More options|More$/i)) throw new Error('no ··· menu (wrong account / not logged in)');
+ if (!await clickByText(/button "More options"/i)) throw new Error('no ··· menu (wrong account / not logged in)');
await sleep(1500);
- // click the Delete menu item
- if (!await clickByText(/\bDelete\b/)) throw new Error('no Delete item (not owner)');
+ // click the Delete menu item — match the BUTTON, not the "Delete post?" heading that also contains "Delete"
+ if (!await clickByText(/button "Delete"/i)) throw new Error('no Delete item (not owner)');
await sleep(1500);
- // IG's confirm is an in-DOM modal with a "Delete" button (not a native dialog).
- if (!await clickByText(/\bDelete\b/)) throw new Error('no confirm Delete button');
+ // IG's confirm dialog has a heading "Delete post?" AND a "Delete" button — target the BUTTON.
+ if (!await clickByText(/button "Delete"/i)) throw new Error('no confirm Delete button');
await sleep(3000);
// Verify: the permalink should now be unavailable.
navigate(r.old_permalink); await sleep(2800);
← d73a58c auto-data-snapshot: 2026-08-17T12:27:54 (1 data files) — age
·
back to Norma
·
IG TK-10617: Option A helper — detect logged-in account + de 4c9304a →