[firefox-devtools-mcp] UID-based tools partially broken in connect-existing mode (element serialization)
Categories
(Developer Infrastructure :: AI for Development, defect, P3)
Tracking
(Not tracked)
People
(Reporter: jdescottes, Unassigned)
References
(Blocks 1 open bug, )
Details
Bug
GeckodriverHttpDriver returns GeckodriverElement wrappers from findElement(), but these don't serialize to W3C element references ({"element-6066-...": "id"}). When passed as arguments to executeScript or actions().move(), geckodriver doesn't recognize them.
Impact by tool
| Tool | Status | Reason |
|---|---|---|
click_by_uid |
Works | Uses GeckodriverElement.click() (direct HTTP) |
fill_by_uid |
Works | Uses el.clear() + el.sendKeys() (direct HTTP) |
hover_by_uid |
Broken | actions().move({ origin: el }) — el serializes wrong |
drag_by_uid_to_uid |
Broken | executeScript('...', fromEl, toEl) — elements become null in browser |
upload_file_by_uid |
Partial | executeScript part broken, sendKeys works |
screenshot_by_uid |
Partial | scrollIntoView broken, takeScreenshot() works via HTTP |
evaluate_script with UID args |
Broken | Elements passed as raw args |
Root cause
GeckodriverHttpDriver.executeScript() sends args raw via JSON:
async executeScript<T>(script: string, ...args: unknown[]): Promise<T> {
return (await this.cmd('POST', '/execute/sync', { script, args })) as T;
}
GeckodriverElement is a plain JS object — it serializes to {}, not a W3C element reference.
Possible fix
GeckodriverElement needs a toJSON() method (or similar) that returns the W3C element reference format, and executeScript/actions need to convert elements before sending. Alternatively, implement ELEMENT_KEY serialization like selenium-webdriver does.
README currently states for connect-existing: "all other features work normally" — this is inaccurate for the tools listed above.
Refs: src/firefox/core.ts:303, src/firefox/core.ts:320, src/firefox/core.ts:419, src/firefox/dom.ts:184, src/firefox/dom.ts:221, src/firefox/dom.ts:274, src/firefox/dom.ts:336
| Reporter | ||
Comment 1•13 days ago
|
||
| Reporter | ||
Comment 2•13 days ago
|
||
PR merged
https://github.com/mozilla/firefox-devtools-mcp/commit/4a235290f0f6db83481efe46d29831cf474ffdbc
Description
•