[object Object]

← back to Norma

TK-11383: make the page-link driver self-diagnosing

19a34d76da258efa4f875344f48533f9e6cb5267 · 2026-09-11 13:46:43 -0700 · Steve Abrams

The first real run reached the Designers Chat professional dashboard but found
no 'Linked accounts' control, and reported nothing useful about what WAS on
screen. Now it tries four label patterns, and on a miss enumerates every visible
control plus the two fallback routes (Page settings while acting as the Page,
and the Instagram app's Accounts Centre — which also covers the phone-only
Business/Creator switch).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

Files touched

Diff

commit 19a34d76da258efa4f875344f48533f9e6cb5267
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Fri Sep 11 13:46:43 2026 -0700

    TK-11383: make the page-link driver self-diagnosing
    
    The first real run reached the Designers Chat professional dashboard but found
    no 'Linked accounts' control, and reported nothing useful about what WAS on
    screen. Now it tries four label patterns, and on a miss enumerates every visible
    control plus the two fallback routes (Page settings while acting as the Page,
    and the Instagram app's Accounts Centre — which also covers the phone-only
    Business/Creator switch).
    
    Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---
 agents/instagram-agent/drive-page-link.mjs | 39 ++++++++++++++++++++++++++----
 1 file changed, 34 insertions(+), 5 deletions(-)

diff --git a/agents/instagram-agent/drive-page-link.mjs b/agents/instagram-agent/drive-page-link.mjs
index 4b7ff2a..5479370 100644
--- a/agents/instagram-agent/drive-page-link.mjs
+++ b/agents/instagram-agent/drive-page-link.mjs
@@ -101,14 +101,43 @@ const state = async (c) => JSON.parse(await evalIn(c, `
     console.log('→ dashboard:', hit || '(control not found)');
   }
 
-  await clickLabel(c, '/^All tools$/i', 8000);
-  const linked = await clickLabel(c, '/linked account/i', 11000);
+  await clickLabel(c, '/^All tools$/i', 10000);
+
+  // Try the likely labels in order of specificity.
+  let linked = null;
+  for (const rx of ['/linked account/i', '/^Linked accounts?$/i', '/linked/i', '/connect.*instagram|instagram.*connect/i']) {
+    linked = await clickLabel(c, rx, 11000);
+    if (linked) break;
+  }
+
   if (!linked) {
     s = await state(c);
-    console.log('\n✗ Could not find a "Linked accounts" control automatically.');
+    // Report what IS on the page so the next run can aim precisely.
+    const inventory = await evalIn(c, `
+      const seen=new Set();
+      document.querySelectorAll('a[href],[role=link],[role=button],button,div[tabindex]').forEach(e=>{
+        const t=(e.innerText||e.getAttribute('aria-label')||'').trim();
+        const r=e.getBoundingClientRect();
+        if(t&&t.length<45&&r.width>0&&r.height>0&&!t.includes('\\n')) seen.add(t);
+      });
+      return JSON.stringify([...seen]);`);
+    console.log('\n✗ No "Linked accounts" control found on this screen.');
     console.log('  You are here:', s.url);
-    console.log('  Navigate by hand: All tools → Linked accounts → Instagram → Connect.\n');
-    console.log(s.text.slice(0, 700));
+    console.log('\n  Visible controls right now:');
+    try {
+      for (const t of JSON.parse(inventory)) console.log('    · ' + t);
+    } catch { console.log('    (could not enumerate)'); }
+    console.log(`
+  Do it by hand from here — on the NEW Pages experience the link usually lives at:
+    Professional dashboard → All tools → "Linked accounts"
+  or, if it isn't listed above, via the Page's own Settings:
+    facebook.com/settings?tab=linked_profiles  (while using Facebook AS the Page)
+
+  The reliable fallback that needs no desktop UI at all:
+    Instagram app → @designerschat → Settings → Accounts Centre
+    → Sharing across profiles / "Connect a Facebook account" → pick "Designers Chat".
+  That path also covers the Business/Creator switch, which is phone-only anyway.
+`);
     c.close();
     return;
   }

← aff4490 auto-data-snapshot: 2026-09-11T13:23:02 (1 data files) — age  ·  back to Norma  ·  TK-11383: enroll @designerschat — IG fleet 35 -> 36 e94fe25 →