> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.doc-detective.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.doc-detective.com/_mcp/server.

# Crop by element (detailed)

> Crop the screenshot to a specific element.

Crop the screenshot to a specific element.

## Referenced In

* [Capture screenshot (detailed)](/reference/schemas/capture-screenshot-detailed)
* [Capture screenshot fields](/reference/schemas/capture-screenshot-fields)

## Fields

| Field            | Type                                                                                 | Description                                                                                                                                                                                                         | Default |
| :--------------- | :----------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------ |
| elementText      | string                                                                               | Optional. Display text of the element to screenshot.                                                                                                                                                                | —       |
| selector         | string                                                                               | Optional. Selector of the element to screenshot.                                                                                                                                                                    | —       |
| elementId        | string                                                                               | Optional. ID attribute of the element to find. Supports exact match or regex pattern using /pattern/ syntax.                                                                                                        | —       |
| elementTestId    | string                                                                               | Optional. data-testid attribute of the element to find. Supports exact match or regex pattern using /pattern/ syntax.                                                                                               | —       |
| elementClass     | one of: - string - array of string                                                   | Optional. Class or array of classes that the element must have. Each class supports exact match or regex pattern using /pattern/ syntax. Element must have all specified classes.                                   | —       |
| elementAttribute | object                                                                               | Optional. Object of attribute key-value pairs that the element must have. Values can be strings (supporting /pattern/ regex), numbers, or booleans. Boolean true matches attribute presence, false matches absence. | —       |
| elementAria      | string                                                                               | Optional. Computed accessible name of the element per ARIA specification. Supports exact match or regex pattern using /pattern/ syntax.                                                                             | —       |
| padding          | one of: - number - object([Padding (detailed)](/reference/schemas/padding-detailed)) | Optional. No description provided.                                                                                                                                                                                  | —       |

## Examples

```json
{
  "elementText": "example",
  "selector": "example",
  "elementId": "example",
  "elementTestId": "example",
  "elementClass": "example",
  "elementAttribute": {},
  "elementAria": "example",
  "padding": 42
}
```