Didacticials

  • To begin
  • Make Automations [comming soon]
  • Make Didacticials or Presentations [comming soon]

Instructions

  • goTo
  • click
  • wait
  • message
  • for
  • alert
  • ifexists / ifnotexists
  • whileExists
  • audio
  • exit

Links

  • Download Zenith
  • jQuery's Selectors

About Zenith

  • Credits and Thanks
  • Binairies Sources

ifexists / ifnotexists

Description

Executes sub-instructions in function of whether an element exists or not

Syntax

Needed pairs :

  • Either :
    • "ifexists" : "selector"
    • "ifnotexists" : "selector"
  • "then" : [Sub-instructions]

optional pairs :

  • "else" : [Sub-instructions]

Additionnal explanation

Details about the arguments :

  • {"then":[Sub-instructions]} : the sub-instructions are executed if the condition is true
  • {"else":[Sub-instructions]} : the sub-instructions are executed if the condition is false

Example

Two tests equivalent with both ifexists and ifnotexists to trace the execution.

The result of those tests depends on the visibility of #element, that you can modify in the play area (below)


{
   "debug":true,
   "do":[
{"ifexists":"#element:visible",
  "then":[
{"alert":"the element exists and is visible"},
{"alert":"ifexists -> then executed"},
  ],
"else":[
{"alert":"the element might exists but is not visible"},
{"alert":"ifexists -> else executed"},
  ]
},

{"ifnotexists":"#element:visible",
  "then":[
{"alert":"ifnotexists -> then executed"},
  ],
"else":[
{"alert":"ifnotexists -> else executed"},
  ]
}
   ],
}

    

Play Area

 #element

© 2009 the Zenith Team.