puppeteer/new-docs/puppeteer.customqueryhandler.md

22 lines
1.2 KiB
Markdown
Raw Normal View History

<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [CustomQueryHandler](./puppeteer.customqueryhandler.md)
## CustomQueryHandler interface
Contains two functions `queryOne` and `queryAll` that can be [registered](./puppeteer.puppeteer.__experimental_registercustomqueryhandler.md) as alternative querying strategies. The functions `queryOne` and `queryAll` are executed in the page context. `queryOne` should take an `Element` and a selector string as argument and return a single `Element` or `null` if no element is found. `queryAll` takes the same arguments but should instead return a `NodeListOf<Element>` or `Array<Element>` with all the elements that match the given query selector.
<b>Signature:</b>
```typescript
export interface CustomQueryHandler
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [queryAll](./puppeteer.customqueryhandler.queryall.md) | (element: Element \| Document, selector: string) =&gt; Element\[\] \| NodeListOf&lt;Element&gt; | |
| [queryOne](./puppeteer.customqueryhandler.queryone.md) | (element: Element \| Document, selector: string) =&gt; Element \| null | |