Skip to content
CodeKruPro

Wait for appearing content and check what is still hidden

Automation taskMediumJava onlyAsked in: Capgemini, Infosys, TCS, Wipro

A follow-up on dynamic pages: "One element has appeared. How do you check that another one is still hidden at that moment?" Wait for the first, then read the state of the second straight away, without waiting, because a wait would hide the timing you want to check.

Handle Dynamic Elements (Appearing Content)

Handle Dynamic Elements

Dynamic elements appear, disappear, or change over time. Handling them requires proper wait strategies.

On the Appearing Elements page, three elements appear at different times (5s, 10s, 15s).

Task:

  1. Navigate to https://testkru.com/Interactions/AppearingElements
  2. Wait for the first element (appearing5sec) to appear
  3. Print its text
  4. Check if the second element is still hidden at this point

Expected output:

First element: Message appeared after 5 seconds
Second still hidden: true