'],
+ ];
+ const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
+ const nodes: Text[] = [];
+ let n: Node | null = walker.nextNode();
+ while (n) { nodes.push(n as Text); n = walker.nextNode(); }
+ for (const node of nodes) {
+ let v = node.nodeValue ?? '';
+ for (const [re, rep] of swaps) v = v.replace(re, rep);
+ if (v !== node.nodeValue) node.nodeValue = v;
+ }
+ });
+}
+
+async function main() {
+ await mkdir(OUT_DIR, { recursive: true });
+ const browser = await chromium.launch({ headless: true });
+ const ctx = await browser.newContext({
+ ignoreHTTPSErrors: true,
+ viewport: { width: 1440, height: 900 },
+ deviceScaleFactor: 2,
+ });
+ const page = await ctx.newPage();
+ try {
+ await login(page);
+ await page.goto(`${BASE}/index.php?page=email-management`, { waitUntil: 'networkidle' });
+
+ // Expand the (collapsed-by-default) "Mail Client Setup" accordion section.
+ await page.locator('button[data-bs-target="#mail-client-setup"]').click();
+ await page.waitForSelector('#custMailDnsDomain', { state: 'visible' });
+ // The zone is populated on DOMContentLoaded; re-run to be safe.
+ await page.evaluate(() => {
+ const fn = (window as unknown as { renderCustMailDns?: () => void }).renderCustMailDns;
+ if (typeof fn === 'function') fn();
+ });
+ await page.waitForTimeout(500);
+
+ await redact(page);
+ const item = page.locator('#mail-client-setup').locator('xpath=ancestor::div[contains(@class,"accordion-item")]');
+ await item.scrollIntoViewIfNeeded();
+ await page.waitForTimeout(300);
+ const path = resolve(OUT_DIR, 'whp-email-autodiscovery.png');
+ await item.screenshot({ path });
+ console.log(`captured whp-email-autodiscovery -> ${path}`);
+ } finally {
+ await browser.close();
+ }
+}
+
+main().catch((err) => { console.error(err); process.exit(1); });