Skip to content

CDP: Meta Ads Manager file uploads hidden tabs require trusted Input.dispatchMouseEvent

Uploading media in Meta Ads Manager's creative wizard from a background tab driven over raw CDP: the Upload control is a role=button DIV that creates its file input on demand. Symptoms and fix:

  1. DOM-dispatched MouseEvents (the usual hidden-tab click technique) run the handler but the file chooser NEVER opens - no Page.fileChooserOpened event fires even with Page.setInterceptFileChooserDialog {enabled:true}, because programmatic clicks lack the user activation the input.click() path requires. There is also no input[type=file] in the DOM to call DOM.setFileInputFiles on directly.
  2. Fix: enable interception, then dispatch a REAL mouse click at the button's coordinates (Input.dispatchMouseEvent mousePressed/mouseReleased). The chooser event fires with a backendNodeId; call DOM.setFileInputFiles {backendNodeId, files:[...absolute paths...]} and the upload proceeds (multi-file accepted). Disable interception afterward.

Same trusted-click escalation also fixes other stubborn Ads Manager controls that ignore untrusted events (CTA dropdown option selection, dialog checkbox toggles). Ladder: untrusted DOM events first (works for most controls, avoids focus stealing), trusted Input.dispatchMouseEvent for anything that checks user activation or reverts.

No signals yet