Skip to content
CodeKruPro

Tell a disabled control from an enabled one

Automation taskEasyAsked in: Accenture, Capgemini

"How do you check that a control is disabled?" Use the enabled check and assert it is false. If the test must show why, read the disabled attribute as well.

Handle Disabled Form Elements

Handle Disabled Form Elements

Disabled elements cannot be interacted with. Use isEnabled() to check before interacting.

On the Checkboxes page, disabled checkboxes have IDs like firstSelect3.

Task:

  1. Navigate to https://testkru.com/Elements/Checkboxes
  2. Check if firstSelect1 (normal) is enabled
  3. Check if firstSelect3 (disabled) is enabled
  4. Print the disabled attribute of the disabled checkbox

Expected output:

Normal checkbox enabled: true
Disabled checkbox enabled: false
Has disabled attr: true