HARPA.AI
LIBRARYUSE CASESGUIDESAI COMMANDSBLOG

Wait Step

CONTENTS

# WAIT

This step forces HARPA to wait for a specified amount of time before proceeding to the next step. This is useful when you need to wait for a page to load, for text or element to appear on the page or JavaScript function to resolve true.

ChatML declaration

# wait for page to stop updating and sending requests
- type: wait
  for: idle
  timeout: 15000

# wait for 1 second
- type: wait
  for: custom-delay
  delay: 1000

# wait for random delay between 500 and 3000 milliseconds
- type: wait
  for: random-delay
  minDelay: 500
  maxDelay: 3000

# wait for text to appear on the page
- type: wait
  for: text-to-appear
  text: Login
  timeout: 15000

# wait for text to disappear from the page
- type: wait
  for: text-to-disappear
  text: Loading
  timeout: 15000

# wait for element to appear on the page
- type: wait
  for: element-to-appear
  selectorType: ai
  selector:
    - $tag: H1
  timeout: 15000

# wait for element to appear on the page
- type: wait
  for: element-to-disappear
  selectorType: ai
  selector:
    - $tag: H1
  timeout: 15000

# wait for JavaScript function to resolve true
- type: wait
  for: js-function
  code: return document.querySelector('h1')
  timeout: 15000
NEXT POST
Contact us
HomeUse CasesGuidesPrivacy PolicyTerms of Service