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(
2023-11-02 15:51:26 +00:00
options: Readonly< ScreenshotOptions > & {
encoding: 'base64';
}
): Promise< string > ;
2023-09-22 12:08:46 +00:00
}
```
## Parameters
2024-03-25 13:03:57 +00:00
< table > < thead > < tr > < th >
2023-09-22 12:08:46 +00:00
2024-03-25 13:03:57 +00:00
Parameter
< / th > < th >
Type
< / th > < th >
Description
< / th > < / tr > < / thead >
< tbody > < tr > < td >
options
< / td > < td >
Readonly< [ScreenshotOptions](./puppeteer.screenshotoptions.md)> & { encoding: 'base64'; }
< / td > < td >
< / td > < / tr >
< / tbody > < / table >
2023-09-22 12:08:46 +00:00
**Returns:**
2023-11-02 15:51:26 +00:00
Promise< string>