class PuppeteerWebBaseLoaderClass that extends the BaseDocumentLoader class and implements the DocumentLoader interface. It represents a document loader for scraping web pages using Puppeteer.
Method that calls the scrape method and returns the scraped HTML content as a Document object.
Method that calls the _scrape method to perform the scraping of the web page specified by the webPath property.
Screenshot a web page and return it as a Document object where the pageContent property is the screenshot encoded in base64.
Static class method used to screenshot a web page and return it as a Document object where the pageContent property is the screenshot encoded in base64.
Static method that imports the necessary Puppeteer modules. It returns a Promise that resolves to an object containing the imported modules.
const loader = new PuppeteerWebBaseLoader("https:exampleurl.com", {
launchOptions: {
headless: true,
},
gotoOptions: {
waitUntil: "domcontentloaded",
},
});
const screenshot = await loader.screenshot();