Utilisez interact pour contrôler une session de navigateur en direct : cliquez sur des boutons, remplissez des formulaires et extrayez du contenu dynamique.
if (req.method === "POST" && url.pathname === "/interact") { const { url: targetUrl } = await req.json(); const result = await firecrawl.scrape(targetUrl, { formats: ['markdown'] }); const scrapeId = result.metadata?.scrapeId; await firecrawl.interact(scrapeId, { prompt: 'Search for iPhone 16 Pro Max' }); const response = await firecrawl.interact(scrapeId, { prompt: 'Click on the first result and tell me the price' }); await firecrawl.stopInteraction(scrapeId); return Response.json({ output: response.output });}