INNER CODE UNIT · JavaScript
pageTarget
test-zeus-ai/testzeus-hercules · frontend/non-interactive/app.js:28
const pageTarget = data.result.targetInfos.find(t => t.type === "page");
if (pageTarget) {
// Attach to the page target
const attachToTarget = {
id: 2,
method: "Target.attachToTarget",
params: { targetId: pageTarget.targetId, flatten: true }
};
socket.send(JSON.stringify(attachToTarget));
} else {
console.error("No page target found!");
document.getElementById("output").innerText = "No page target found!";
}
}
// Handle attachToTarget response
if (data.id === 2 && data.result) {
sessionId = data.result.sessionId;