16

I know I can use:

casper.test.assertExists(#selector);

But I want to actually store if it exists in a boolean variable.

I.e. something like this:

var exists = SelectorExists(#selector);
Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
Henley
  • 21,258
  • 32
  • 119
  • 207

1 Answers1

31

I just found out:

if(!casper.exists('#selector')){
   #selector doesn't exist
}
BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Henley
  • 21,258
  • 32
  • 119
  • 207