const agent = new HyperAgent();
const pages = await Promise.all([
agent.newPage(),
agent.newPage(),
agent.newPage(),
]);
// Navigate all pages in parallel
await Promise.all([
pages[0].goto("https://amazon.com"),
pages[1].goto("https://ebay.com"),
pages[2].goto("https://walmart.com"),
]);
// Search on all pages in parallel
const results = await Promise.all([
pages[0].ai("search for 'wireless mouse' and find the cheapest option"),
pages[1].ai("search for 'wireless mouse' and find the cheapest option"),
pages[2].ai("search for 'wireless mouse' and find the cheapest option"),
]);
// Extract prices from all pages
const prices = await Promise.all([
pages[0].extract("get the lowest price", z.number()),
pages[1].extract("get the lowest price", z.number()),
pages[2].extract("get the lowest price", z.number()),
]);
console.log("Prices:", prices);
await agent.closeAgent();