> ## Documentation Index
> Fetch the complete documentation index at: https://intunedhq.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# extractArrayFromLocator

> [!WARNING]
>
> **Deprecated:** This function is deprecated and will be removed in the future.

Extracts an array of structured data from a locator.

```typescript theme={null}
export declare function extractArrayFromLocator(
  locator: Locator,
  options: {
    label: string;
    itemEntityName: string;
    itemEntitySchema: SimpleArrayItemSchema;
    strategy?: ImageStrategy | HtmlStrategy;
    prompt?: string;
    optionalPropertiesInvalidator?: (
      result: Record<string, string>[]
    ) => string[];
    variantKey?: string;
    apiKey?: string;
  }
): Promise<Record<string, string>[]>;
```

## Examples

```typescript extractArrayFromLocator theme={null}
import { extractArrayFromLocator } from "@intuned/browser/optimized-extractors";

await page.goto("https://books.toscrape.com/");
const books = await extractArrayFromLocator(page.locator("section"), {
  itemEntityName: "book",
  label: "books-extraction",
  itemEntitySchema: {
    type: "object",
    required: ["name"],
    properties: {
      name: {
        type: "string",
        description: "book name",
        primary: true,
      },
    },
  },
});

console.log(books);

// output:
// [
// ...
// { name: 'Olio' },
// { name: 'Mesaerion: The Best Science Fiction Stories 1800-1849' },
// { name: 'Libertarianism for Beginners' },
// { name: "It's Only the Himalayas" }
// ...
// ]
```

## Arguments

**locator** `any` *required*

The Playwright Locator object from which to extract the data.

**options** `object` *required*

**properties**

**options.label** `any` *required*

A label for this extraction process, used for billing and monitoring.

**options.itemEntityName** `any` *required*

The name of the entity items being extracted. Must be 1–50 characters long and can only contain letters, digits, periods, underscores, and hyphens.

**options.itemEntitySchema** `any` *required*

The schema of the entity items being extracted.

**options.strategy** `any` *required*

Optional. The strategy to use for extraction, if not provided, the html strategy with claude haiku will be used.

**options.prompt** `any` *required*

Optional. A prompt to guide the extraction process.

**options.optionalPropertiesInvalidator** `any` *required*

Optional. A function to invalidate optional properties.

**options.variantKey** `any` *required*

Optional. A variant key for the extraction process.

**options.apiKey** `any` *required*

Optional. An API key for AI extraction. Extractions made with your API key won't be billed to your account.

## Returns: `any`

A promise that resolves to a list of extracted data.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.