Puppeteer icon

Puppeteer

Automate browser interactions using Puppeteer

Run Custom Script

AI-generated

Summary

Execute custom JavaScript in a Puppeteer browser context; script must return an array of n8n items.

Inputs

  • scriptCode (required) — JavaScript code to execute with Puppeteer. Has access to $page, $browser, $puppeteer, and $input.query. Runs in a codeNodeEditor with JavaScript language mode.
  • query — Input query for AI agents; passed as $input.query in the custom script. Defaults to empty string.

Output shape

array

Array of n8n items, each containing json and/or binary properties, normalized from the script's return value. If captureDownloads is enabled and the script triggers downloads, binary data from downloaded files is merged into the first output item.

Examples

Example 1: Basic IP lookup

Run Custom Script with default code navigating to https://httpbin.org/ip and returning the origin IP as { ip: '...' }. Output: [{ json: { ip: 'xxx.xxx.xxx.xxx' } }].

Links

Discussion