Skip to content
CodeKruPro

Get Element Attributes

17/70

Get Element Attributes

locator.getAttribute(name) returns the value of an HTML attribute.

On the Text Fields page, the disabled field has:

<input type="text" id="disabledField" value="Codekru" disabled>

Task:

  1. Navigate to https://testkru.com/Elements/TextFields
  2. Find the disabled field by ID
  3. Print its type attribute
  4. Print its value attribute
  5. Print whether the disabled attribute exists (it returns empty string or null)

Expected output:

Type: text
Value: Codekru
Disabled: true