-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(queryhandler): add custom query handler docs (#6476)
- Loading branch information
Showing
12 changed files
with
178 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [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) => Element\[\] \| NodeListOf<Element> | | | ||
| [queryOne](./puppeteer.customqueryhandler.queryone.md) | (element: Element \| Document, selector: string) => Element \| null | | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [CustomQueryHandler](./puppeteer.customqueryhandler.md) > [queryAll](./puppeteer.customqueryhandler.queryall.md) | ||
|
||
## CustomQueryHandler.queryAll property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
queryAll?: (element: Element | Document, selector: string) => Element[] | NodeListOf<Element>; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [CustomQueryHandler](./puppeteer.customqueryhandler.md) > [queryOne](./puppeteer.customqueryhandler.queryone.md) | ||
|
||
## CustomQueryHandler.queryOne property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
queryOne?: (element: Element | Document, selector: string) => Element | null; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
new-docs/puppeteer.puppeteer.__experimental_clearqueryhandlers.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Puppeteer](./puppeteer.puppeteer.md) > [\_\_experimental\_clearQueryHandlers](./puppeteer.puppeteer.__experimental_clearqueryhandlers.md) | ||
|
||
## Puppeteer.\_\_experimental\_clearQueryHandlers() method | ||
|
||
Clears all registered handlers. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
__experimental_clearQueryHandlers(): void; | ||
``` | ||
<b>Returns:</b> | ||
|
||
void | ||
|
17 changes: 17 additions & 0 deletions
17
new-docs/puppeteer.puppeteer.__experimental_customqueryhandlernames.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Puppeteer](./puppeteer.puppeteer.md) > [\_\_experimental\_customQueryHandlerNames](./puppeteer.puppeteer.__experimental_customqueryhandlernames.md) | ||
|
||
## Puppeteer.\_\_experimental\_customQueryHandlerNames() method | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
__experimental_customQueryHandlerNames(): string[]; | ||
``` | ||
<b>Returns:</b> | ||
|
||
string\[\] | ||
|
||
a list with the names of all registered custom query handlers. | ||
|
34 changes: 34 additions & 0 deletions
34
new-docs/puppeteer.puppeteer.__experimental_registercustomqueryhandler.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Puppeteer](./puppeteer.puppeteer.md) > [\_\_experimental\_registerCustomQueryHandler](./puppeteer.puppeteer.__experimental_registercustomqueryhandler.md) | ||
|
||
## Puppeteer.\_\_experimental\_registerCustomQueryHandler() method | ||
|
||
Registers a [custom query handler](./puppeteer.customqueryhandler.md)<!-- -->. After registration, the handler can be used everywhere where a selector is expected by prepending the selection string with `<name>/`<!-- -->. The name is only allowed to consist of lower- and upper case latin letters. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
__experimental_registerCustomQueryHandler(name: string, queryHandler: CustomQueryHandler): void; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| name | string | The name that the custom query handler will be registered under. | | ||
| queryHandler | [CustomQueryHandler](./puppeteer.customqueryhandler.md) | The [custom query handler](./puppeteer.customqueryhandler.md) to register. | | ||
|
||
<b>Returns:</b> | ||
|
||
void | ||
|
||
## Example | ||
|
||
|
||
``` | ||
puppeteer.registerCustomQueryHandler('text', { … }); | ||
const aHandle = await page.$('text/…'); | ||
``` | ||
|
22 changes: 22 additions & 0 deletions
22
new-docs/puppeteer.puppeteer.__experimental_unregistercustomqueryhandler.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Puppeteer](./puppeteer.puppeteer.md) > [\_\_experimental\_unregisterCustomQueryHandler](./puppeteer.puppeteer.__experimental_unregistercustomqueryhandler.md) | ||
|
||
## Puppeteer.\_\_experimental\_unregisterCustomQueryHandler() method | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
__experimental_unregisterCustomQueryHandler(name: string): void; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| name | string | The name of the query handler to unregistered. | | ||
|
||
<b>Returns:</b> | ||
|
||
void | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters