ci / go (push) Waiting to run
ci / go-db (agent) (push) Waiting to run
ci / go-db (config) (push) Waiting to run
ci / go-db (db) (push) Waiting to run
ci / go-db (evidence) (push) Waiting to run
ci / go-db (llmrec) (push) Waiting to run
ci / go-db (server) (push) Waiting to run
web / web (push) Waiting to run
docs / links (push) Canceled after 0s
detections / detections (push) Canceled after 0s
24 lines
665 B
Markdown
24 lines
665 B
Markdown
# 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
|
|
|
|
```bash
|
|
playwright-cli snapshot
|
|
# snapshot shows a button as e7 but doesn't reveal its id or data attributes
|
|
|
|
# get the element's id
|
|
playwright-cli eval "el => el.id" e7
|
|
|
|
# get all CSS classes
|
|
playwright-cli eval "el => el.className" e7
|
|
|
|
# get a specific attribute
|
|
playwright-cli eval "el => el.getAttribute('data-testid')" e7
|
|
playwright-cli eval "el => el.getAttribute('aria-label')" e7
|
|
|
|
# get a computed style property
|
|
playwright-cli eval "el => getComputedStyle(el).display" e7
|
|
```
|