29 lines
875 B
Markdown
29 lines
875 B
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
|
|
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [$](./puppeteer.page._.md)
|
|
|
|
## Page.$() method
|
|
|
|
Runs `document.querySelector` within the page. If no element matches the selector, the return value resolves to `null`.
|
|
|
|
<b>Signature:</b>
|
|
|
|
```typescript
|
|
$<T extends Element = Element>(selector: string): Promise<ElementHandle<T> | null>;
|
|
```
|
|
|
|
## Parameters
|
|
|
|
| Parameter | Type | Description |
|
|
| --- | --- | --- |
|
|
| selector | string | A <code>selector</code> to query page for [selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) to query page for. |
|
|
|
|
<b>Returns:</b>
|
|
|
|
Promise<[ElementHandle](./puppeteer.elementhandle.md)<T> \| null>
|
|
|
|
## Remarks
|
|
|
|
Shortcut for [Page.mainFrame().$(selector)](./puppeteer.frame._.md).
|
|
|