Extracts a list of objects from a web page using the specified static selectors.
Type parameters
• T extends ListStaticExtractor
Examples
import { extractArrayFromPageUsingSelectors, goto } from "@intuned/sdk/playwright";
await goto(page, 'https://books.toscrape.com/index.html');
const books = await extractArrayFromPageUsingSelectors(page, {
containerSelector: {
selector: '//*[@id="default"]/div/div/div/div/section/div[2]/ol',
type: "xpath"
},
propertySelectors: {
name: {
selector: "h3",
},
inStock: {
selector: ".price_color",
},
imgUrl: {
selector: "article > div.image_container > a > img",
selectionMethod: {
propertyName: "src"
}
}
}
})
console.log(books)
Parameters
• page: Page
The Playwright Page object from which to extract the data.
• listExtractor: T
The list static extractor with the selectors to use.
Returns
Promise
<ExtractListObjectsUsingStaticSelectorsReturnType
<T
>>
A promise that resolves to the extracted list of objects.