locator.getAttribute

View as Markdown

locator.getAttribute is a browser runtime capability in the locator namespace.

Availability

  • Runtime: browser
  • Kind: raw
  • Category: extraction
  • Supported drivers: Playwright, Puppeteer

SDK Surface

  • SDK path: runtime.page.locator(...).getAttribute
  • Async: Yes

HTTP Surface

  • Transport: workspace.execute(...)
  • Call: locator.getAttribute
  • Long-running: No

Reference Semantics

  • Requires refs: locator

Arguments

ArgumentTypeRequiredDescription
namestringYesAttribute name.

Result

  • Type: string | null
  • Description: Attribute value if present.

SDK Example

1await runtime.page.locator('button[type=submit]').getAttribute('href');

HTTP Example

1{
2 "runtime": "crm",
3 "steps": [
4 {
5 "call": "locator.getAttribute",
6 "args": [
7 "href"
8 ]
9 }
10 ]
11}