[{"data":1,"prerenderedAt":73},["ShallowReactive",2],{"content-\u002Fbuild-with-code\u002Fpuppeteer":3,"content-doc-\u002Fbuild-with-code\u002Fpuppeteer-inline":3},{"id":4,"title":5,"body":6,"date":64,"description":65,"extension":66,"meta":67,"navigation":68,"order":64,"path":69,"seo":70,"stem":71,"__hash__":72},"content\u002Fbuild-with-code\u002Fpuppeteer.md","Run Puppeteer in the Cloud, No Chromium to Maintain | axiom.ai",{"type":7,"value":8,"toc":60},"minimark",[9,16,24,33,42,53],[10,11],"left-hero",{"description":12,"primaryText":13,"primaryTo":14,"title":15},"Point puppeteer.connect at our WebSocket and the script you already wrote runs on fresh cloud Chrome. You manage your script. We manage Chrome.","Get API key","https:\u002F\u002Fcode.axiom.ai","Run Puppeteer scripts in the cloud. Change one line.",[17,18],"api-code-example",{"caption":19,"code":20,"linkText":21,"name":22,"to":23},"Point puppeteer.connect at our WebSocket endpoint. The rest of your script doesn't change.","import puppeteer from \"puppeteer\";\n\nconst browser = await puppeteer.connect({\n  browserWSEndpoint:\n    `wss:\u002F\u002Fcdp-lb.axiom.ai\u002F?token=${process.env.AXIOM_API_KEY}`\n});\n\ntry {\n  const page = await browser.newPage();\n  await page.goto(\"https:\u002F\u002Fexample.com\");\n  await page.screenshot({ path: \"out.png\", fullPage: true });\n} finally {\n  await browser.close();\n}\n","Read the Chrome API docs","Puppeteer","\u002Fdocs\u002Fdeveloper-hub\u002Fapi\u002Fcdp",[25,26],"feature-list",{":items":27,"description":28,"eyebrow":29,"link":30,"linkText":31,"title":32},"[{\"title\":\"Swap launch() for connect()\",\"description\":\"Add your API key and run. That's the whole change.\",\"to\":\"\u002Fbuild-with-code\u002Fapi\u002Fchrome\",\"linkText\":\"Explore the Chrome API\",\"code\":\"const browser = await puppeteer.connect({\\n  browserWSEndpoint: `wss:\u002F\u002Fcdp-lb.axiom.ai\u002F?token=${KEY}`\\n});\\n\"},{\"title\":\"No Chromium install\",\"description\":\"Every session gets current cloud Chrome. Nothing to download in CI, nothing to rebuild when Chromium updates.\"},{\"title\":\"Scale your sessions\",\"description\":\"Up to 20 concurrent sessions in the cloud, unlimited on desktop, and more on request. Parallel work means more connections, not more servers, and runtime only meters while a session is open.\",\"to\":\"\u002Finfrastructure\",\"linkText\":\"See infrastructure\"},{\"title\":\"Your data stays yours\",\"description\":\"Each cloud session gets its own server with a private Docker container, desktop runs never leave your machine, and we never train AI on anything that passes through either.\"}]","Your script connects to a browser in our cloud instead of launching its own. Nothing else changes.","The switch","\u002Fbuild-with-code\u002Fapi\u002Fchrome","Explore the Chrome API","Stop launching Chromium. Connect to ours.",[34,35],"code-tiles-grid",{":tiles":36,"description":37,"eyebrow":38,"link":39,"linkText":40,"title":41},"[{\"title\":\"Log in and scrape\",\"code\":\"await axiom.browserOpen();\\ntry {\\n  await axiom.goto(\\\"https:\u002F\u002Fexample.com\u002Flogin\\\");\\n  await axiom.enterText(\\\"#email\\\", \\\"user@example.com\\\");\\n  await axiom.enterText(\\\"#password\\\", process.env.PW);\\n  await axiom.click(\\\"button[type=submit]\\\");\\n  await axiom.wait(2000);\\n  const rows = await axiom.scrape(null, { hierarchy: \\\".product-card\\\" }, null, 50, {});\\n} finally {\\n  await axiom.browserClose();\\n}\\n\"},{\"title\":\"Fill in a form\",\"code\":\"await axiom.goto(\\\"https:\u002F\u002Fexample.com\u002Fapply\\\");\\nawait axiom.enterText(\\\"#full-name\\\", row.name);\\nawait axiom.selectList(\\\"#country\\\", row.country);\\nawait axiom.click(\\\"button[type=submit]\\\");\\n\"},{\"title\":\"Use AI mid-run\",\"code\":\"const [[title], [description]] = await axiom.scrapeMetadata([\\n  { id: \\\"general_metadata_title\\\" },\\n  { id: \\\"meta_description\\\", value: 'meta[name=\\\"description\\\"]' }\\n]);\\nconst verdict = await axiom.integrateAI({\\n  aiFunction: \\\"generate\\\",\\n  prompt: `Product page or category page? ${title} ${description}`\\n});\\n\"},{\"title\":\"Combine with your own code\",\"code\":\"const targets = await db.query(\\\"SELECT url FROM watchlist\\\");\\nawait axiom.browserOpen();\\ntry {\\n  for (const { url } of targets) {\\n    await axiom.goto(url);\\n    const [[price]] = await axiom.scrape(null, { hierarchy: \\\".price\\\" }, null, 1, {});\\n    if (Number(price) \u003C 100) await notifySlack(url, price);\\n  }\\n} finally {\\n  await axiom.browserClose();\\n}\\n\"}]","The browser you connected to also takes Step API calls, functions from the engine behind our No-Code Tool. One call scrapes a paginated list, solves a captcha, or walks a date picker, using the selectors you already have.","Also available","\u002Fbuild-with-code\u002Fapi\u002Fstep","Explore the Step API","Mix Step API calls into the same script.",[43,44,47],"grid-fade-wrap",{"bg":45,"color":46},"gray-to-white","default",[48,49],"call-to-action",{":shapes":50,"headline":51,"linkText":13,"linkTo":14,"text":52},"[\"cube\"]","Get an API key and try the Chrome API for free.\n","2 free hours of runtime. No card required.",[54,55],"cross-links",{":links":56,"className":57},"[{\"eyebrow\":\"Go deeper\",\"title\":\"Chrome API\",\"to\":\"\u002Fbuild-with-code\u002Fapi\u002Fchrome\"},{\"eyebrow\":\"Go deeper\",\"title\":\"Step API\",\"to\":\"\u002Fbuild-with-code\u002Fapi\u002Fstep\"}]",[58,59],"gray","iso-grid-gray-100",{"title":61,"searchDepth":62,"depth":62,"links":63},"",3,[],null,"Run Puppeteer in the cloud on axiom.ai. Swap puppeteer.launch() for puppeteer.connect() and your scripts drive fresh cloud Chrome. No installs, no scaling plumbing.","md",{},true,"\u002Fbuild-with-code\u002Fpuppeteer",{"title":5,"description":65},"build-with-code\u002Fpuppeteer","uecCce6UI_yxec5hIFvNT5o794GE5KlYE2ZcDzVxM-I",1785947371009]