2026-05-20 21:39:12 +08:00

671 B

Inspecting Element Attributes

When the snapshot doesn't show an element's id, class, data-* attributes, or other DOM properties, use eval to inspect them.

Examples

patchwright-cli snapshot
# snapshot shows a button as e7 but doesn't reveal its id or data attributes

# get the element's id
patchwright-cli eval "el => el.id" e7

# get all CSS classes
patchwright-cli eval "el => el.className" e7

# get a specific attribute
patchwright-cli eval "el => el.getAttribute('data-testid')" e7
patchwright-cli eval "el => el.getAttribute('aria-label')" e7

# get a computed style property
patchwright-cli eval "el => getComputedStyle(el).display" e7