2023-09-22 12:08:46 +00:00
---
sidebar_label: ElementHandle.screenshot
---
# ElementHandle.screenshot() method
2023-10-06 11:48:06 +00:00
This method scrolls element into view if needed, and then uses [Page.screenshot() ](./puppeteer.page.screenshot_1.md ) to take a screenshot of the element. If the element is detached from DOM, the method throws an error.
2023-09-22 12:08:46 +00:00
#### Signature:
```typescript
class ElementHandle {
screenshot(
this: ElementHandle< Element > ,
options?: Readonly< ElementScreenshotOptions >
): Promise< string | Buffer > ;
}
```
## Parameters
| Parameter | Type | Description |
| --------- | ----------------------------------------------------------------------------------- | ------------ |
| this | [ElementHandle ](./puppeteer.elementhandle.md )< Element> | |
| options | Readonly< [ElementScreenshotOptions](./puppeteer.elementscreenshotoptions.md)> | _(Optional)_ |
**Returns:**
Promise< string \| Buffer>