Get a Browserless Puppeteer Connection Example

Site browserless.ioTask get-puppeteer-browserless-exampleVersion v1Updated Aug 4, 2026Category developer-documentation

Open Browserless and extract the basic Puppeteer code example that connects to the Browserless service. This skill was captured from a live agent session on browserless.io and publishes here verbatim, exactly as an agent receives it.

NoteSelectors and URL schemes drift as sites change. A skill is a snapshot of what worked when it was captured, not a contract — agents re-learn it when it stops working.

Purpose

Retrieve the basic Puppeteer example shown on the Browserless website, including the connection code needed to connect Puppeteer to Browserless.

When to Use

Use when the caller asks for a basic Puppeteer or Puppeteer-connect example for Browserless. This recipe returns the code displayed by the site's Puppeteer example panel rather than inventing connection details.

Workflow

  1. Navigate directly to https://www.browserless.io/.
  2. Open the expandable control whose accessible name or visible text is Puppeteer. Prefer a role/name selector such as button with accessible name Puppeteer; do not hard-code the generated Radix element id. If the panel is already expanded, skip this step.
  3. On the resulting page, run the following evaluate() and return the matching code block(s):
(() => {
  const clean = (value) => (value || "").replace(/\s+/g, " ").trim();
  const blocks = [...document.querySelectorAll("pre")]
    .map((el, index) => ({
      index,
      text: (el.innerText || el.textContent || "").trim(),
      visible: !!(el.offsetWidth || el.offsetHeight || el.getClientRects().length),
    }))
    .filter((block) => block.visible && block.text);
  const matches = blocks.filter(({ text }) =>
    /puppeteer|browserless|connect|websocket/i.test(text),
  );
  return {
    examples: matches.length ? matches : blocks,
    code: (matches.length ? matches : blocks).map(({ text }) => text),
  };
})();

Site-Specific Gotchas

  • The Puppeteer example is revealed through an expandable UI control on the homepage; it is not necessarily visible in the initial DOM viewport.
  • The control uses a generated Radix-style DOM id, so identify it by accessible name or visible text rather than an id such as radix-...-trigger-puppeteer.
  • Code examples are rendered in pre elements. Filter visible blocks and prefer blocks mentioning Puppeteer, Browserless, connect, or a WebSocket connection because the page may contain multiple examples.
  • The Browserless homepage is directly reachable at /; no homepage search or documentation navigation is required for this example.
  • Preserve the returned code exactly, including placeholders or environment-variable references, instead of substituting credentials or inventing a token.

Expected Output

Return the extracted Puppeteer example code, preferably as the code array from the evaluator, along with the structured examples entries when context such as the block index is useful.

Call it

GET https://production-sfo.browserless.io/skills?token=TOKEN-HERE&domain=browserless.io&task=get-puppeteer-browserless-example