Skip to content
CodeKruPro

Check whether an element is displayed

Automation taskEasyAsked in: Accenture, Capgemini

"isDisplayed versus isEnabled versus isSelected: what does each check?" Start with displayed, which asks whether a user can see the element. Compare a visible field with one hidden by visibility:hidden (a style that hides the element but keeps its space).

isDisplayed() - Check Element Visibility

isDisplayed() - Check Visibility

isDisplayed() returns true if an element is visible on the page. Elements with visibility: hidden or display: none return false.

Task:

  1. Navigate to https://testkru.com/Elements/TextFields
  2. Check if firstName (visible) is displayed
  3. Check if invisibleField (hidden with visibility:hidden) is displayed

Expected output:

firstName displayed: true
invisibleField displayed: false
Read full tutorial on Codekru