The simplest way to scrape a page from your own code
This guide drops a scraper straight into your Node code: one axiom.scrape() call, structured rows back, no server to stand up. The scrape runs against a real Chromium on the Step API — same SDK gives you axiom.enterText, axiom.click, axiom.goto, and the rest of the step library, so logging in before a scrape, walking pagination, or filling a form on the way through is the same shape of code. Point the SDK at a local CDP endpoint instead of the cloud and the exact same calls drive your own browser. No Puppeteer wiring, no container ops, no separate scraping service to maintain.
The whole thing
// npm install @axiom_ai/api
import { AxiomApi } from '@axiom_ai/api';
const API_KEY = "eyJ1c2VyX2lkIjoyMzI5LCJ0b2tlbiI6IjIzMjkyNjlmY2EwNDlhY2Q0MThkIn0="; // paste your key here
const axiom = new AxiomApi(API_KEY);
async function scrapeWebsite() {
await axiom.browserOpen();
try {
// scrape() returns a 2D array: rows × fields
const rows = await axiom.scrape(
"https://bbc.com", // scrape() navigates here itself (url is required)
"a", // record selector
null, // no pagination
50, // max results
{} // default settings
);
return rows; // hand the data back to your code
} finally {
await axiom.browserClose();
}
}
// now it's just data in your app, use it however you like
const scrapedData = await scrapeWebsite();
console.log(scrapedData);
// 2D array, rows × fields:
// [
// ["Headline A"],
// ["Headline B"],
// ]
const firstRow = scrapedData[0][0]; // first scraped value
Open a session, call scrape() with the URL you want, and it navigates there and pulls the records. It returns a 2D array, rows by fields, straight into rows. You hand that back out of the function, and now products is plain data sitting in your code: index into it (products[0][1]), map over it, save it, whatever your app needs. Close the session when you're done.
Need to log in or click something first? Run goto(), enterText(), and click() before the scrape, then pass null as the URL so scrape() reads the page you're already on.
Why it's the easy path
The scrape runs on axiom.ai's infrastructure, so there's no Chromium to install and no Puppeteer to wire up. And because it's just a call inside your code, it goes wherever your code goes: a backend route, a worker, a cron script, a CLI, whatever you're building. Add the step, call the API, use the data.
Keep three things right
- Always
browserClose()in afinally. An open session keeps burning runtime. - Keep your API key in the environment, not in the source.
- Grab selectors from the No-Code Tool's selector tool instead of hand-writing them.