Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test if selector exists in CasperJS?

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);
like image 559
Henley Avatar asked Sep 03 '12 20:09

Henley


1 Answers

I just found out:

if(!casper.exists('#selector')){
   #selector doesn't exist
}
like image 195
Henley Avatar answered Oct 01 '22 22:10

Henley