CompatibilityOnly available on Node.js.
CheerioWebBaseLoader
instead.
Setup
npm
Usage
Options
Here’s an explanation of the parameters you can pass to the PlaywrightWebBaseLoader constructor using the PlaywrightWebBaseLoaderOptions interface:-
launchOptions
: an optional object that specifies additional options to pass to the playwright.chromium.launch() method. This can include options such as the headless flag to launch the browser in headless mode. -
gotoOptions
: an optional object that specifies additional options to pass to the page.goto() method. This can include options such as the timeout option to specify the maximum navigation time in milliseconds, or the waitUntil option to specify when to consider the navigation as successful. -
evaluate
: an optional function that can be used to evaluate JavaScript code on the page using a custom evaluation function. This can be useful for extracting data from the page, interacting with page elements, or handling specific HTTP responses. The function should return a Promise that resolves to a string containing the result of the evaluation.
PlaywrightWebBaseLoader
constructor, you can customize the behavior of the loader and use Playwright’s powerful features to scrape and interact with web pages.
Here is a basic example to do it: