2020-06-04 14:56:45 +00:00
|
|
|
<!-- 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
|
|
|
|
|
2020-06-26 07:24:56 +00:00
|
|
|
Runs `document.querySelector` within the page. If no element matches the selector, the return value resolves to `null`<!-- -->.
|
|
|
|
|
2020-06-04 14:56:45 +00:00
|
|
|
<b>Signature:</b>
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
$(selector: string): Promise<ElementHandle | null>;
|
|
|
|
```
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
|
|
|
| Parameter | Type | Description |
|
|
|
|
| --- | --- | --- |
|
2020-06-26 07:24:56 +00:00
|
|
|
| selector | string | A [selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) to query page for. |
|
2020-06-04 14:56:45 +00:00
|
|
|
|
|
|
|
<b>Returns:</b>
|
|
|
|
|
|
|
|
Promise<[ElementHandle](./puppeteer.elementhandle.md) \| null>
|
|
|
|
|
2020-06-26 07:24:56 +00:00
|
|
|
## Remarks
|
|
|
|
|
|
|
|
Shortcut for [Page.mainFrame().$(selector)](./puppeteer.frame._.md)<!-- -->.
|
|
|
|
|