puppeteer/website/versioned_docs/version-15.3.0/api/puppeteer.customqueryhandler.md
release-please[bot] 01c76b7eb1
chore(main): release 15.3.0 (#8606)
* chore(main): release 15.3.0

* chore: generate versioned docs

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
2022-07-01 17:02:54 +02:00

21 lines
1.4 KiB
Markdown

---
sidebar_label: CustomQueryHandler
---
# CustomQueryHandler interface
Contains two functions `queryOne` and `queryAll` that can be [registered](./puppeteer.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.
**Signature:**
```typescript
export interface CustomQueryHandler
```
## Properties
| Property | Modifiers | Type | Description |
| ------------------------------------------------------- | --------- | ----------------------------------------------------------------------------------------------- | ----------------- |
| [queryAll?](./puppeteer.customqueryhandler.queryall.md) | | (element: Element \| Document, selector: string) =&gt; Element\[\] \| NodeListOf&lt;Element&gt; | <i>(Optional)</i> |
| [queryOne?](./puppeteer.customqueryhandler.queryone.md) | | (element: Element \| Document, selector: string) =&gt; Element \| null | <i>(Optional)</i> |