LP.* is Koko's custom CDP domain for agent-oriented automation — token-efficient extraction, semantic DOM, and stable backendNodeId handles that survive better than fragile CSS selectors.
Extraction APIs
| CDP method | SDK equivalent | Description |
|---|---|---|
LP.getMarkdown | page.markdown() | Token-efficient page text |
LP.getSemanticTree | page.semanticTree() | Pruned a11y DOM for LLMs |
LP.getStructuredData | page.getStructuredData() | JSON-LD, OpenGraph, meta |
LP.detectForms | page.detectForms() | Form schema + field IDs |
LP.getInteractiveElements | page.getInteractiveElements() | Clickable/focusable inventory |
Node actions
| CDP method | SDK equivalent |
|---|---|
LP.fillNode | page.node(id).fill() |
LP.clickNode | page.node(id).click() |
LP.hoverNode | page.node(id).hover() |
LP.pressKey | page.node(id).press() |
LP.selectOptionNode | page.node(id).selectOption() |
LP.setCheckedNode | page.node(id).check() / uncheck() |
LP.getNodeDetails | page.waitForSelectorHandle() |
LP.handleJavaScriptDialog | page.armDialog() |
Agent workflow example
const [search] = await page.findElement({ role: "combobox", name: "search" });
const input = page.node(search.backendNodeId!);
await input.fill("Koko browser");
const submit = await page.waitForSelectorHandle('input[name="btnK"]');
await submit.click();
Navigation wait
waitUntil: "done" is the MCP default and LP-aware navigation wait — stricter than Playwright networkidle.
Known limitations
LP.clickNodecan hang on some submit buttons that trigger full navigation- Do not infer click health from fill health — different synchronization paths
Handlers implemented in src/protocols/cdp/domains/lp.zig.