- Created nav-debug.cjs to log anchor tags and simulate clicks on the Voice navigation link, capturing click events and page navigation. - Added nav-test.cjs to test the Voice link click and log the URL at various intervals, capturing any page errors. - Introduced nav-test2.cjs to check the presence of specific elements on the /voice/ page and log any console errors. - Implemented nav-test4019.cjs to monitor network requests and responses related to the Voice navigation, verifying button presence and click functionality.
26 lines
1.4 KiB
JavaScript
26 lines
1.4 KiB
JavaScript
const puppeteer = require("puppeteer-core");
|
|
(async () => {
|
|
const browser = await puppeteer.launch({ executablePath: "/usr/bin/google-chrome", headless: true, args: ["--no-sandbox","--disable-setuid-sandbox"] });
|
|
const page = await browser.newPage();
|
|
const net = [];
|
|
page.on("request", (r) => { const u = r.url(); if (u.includes("_rsc") || u.includes("/voice")) net.push("REQ " + r.method() + " " + u); });
|
|
page.on("response", (r) => { const u = r.url(); if (u.includes("_rsc") || u.includes("/voice")) net.push("RES " + r.status() + " " + u); });
|
|
page.on("pageerror", (e) => console.log("PAGEERR:", e.message));
|
|
await page.goto("http://127.0.0.1:4019/dashboard/", { waitUntil: "domcontentloaded", timeout: 30000 });
|
|
await new Promise((r) => setTimeout(r, 2500));
|
|
|
|
const info = await page.evaluate(() => {
|
|
const b = document.querySelector('button[aria-label="Voice"]');
|
|
const a = document.querySelector('a[aria-label="Voice"]');
|
|
return { buttonPresent: !!b, aPresent: !!a };
|
|
});
|
|
console.log("NAV button present:", info.buttonPresent, "| a present:", info.aPresent);
|
|
|
|
await page.evaluate(() => {
|
|
const b = document.querySelector('button[aria-label="Voice"]');
|
|
if (b) b.click();
|
|
});
|
|
await new Promise((r) => setTimeout(r, 3000));
|
|
console.log("URL after click:", page.url(), "| history:", await page.evaluate(() => history.length));
|
|
await browser.close();
|
|
})().catch((e) => { console.error("FAIL:", e.message); process.exit(1); }); |