reintroduced CasperUtils#exists, erroneously deleted on merge
Showing
1 changed file
with
14 additions
and
0 deletions
... | @@ -546,6 +546,20 @@ | ... | @@ -546,6 +546,20 @@ |
546 | }; | 546 | }; |
547 | 547 | ||
548 | /** | 548 | /** |
549 | * Checks if a given DOM element exists in remote page. | ||
550 | * | ||
551 | * @param String selector CSS3 selector | ||
552 | * @return Boolean | ||
553 | */ | ||
554 | this.exists = function(selector) { | ||
555 | try { | ||
556 | return document.querySelectorAll(selector).length > 0; | ||
557 | } catch (e) { | ||
558 | return false; | ||
559 | } | ||
560 | }; | ||
561 | |||
562 | /** | ||
549 | * Downloads a resource behind an url and returns its base64-encoded | 563 | * Downloads a resource behind an url and returns its base64-encoded |
550 | * contents. | 564 | * contents. |
551 | * | 565 | * | ... | ... |
-
Please register or sign in to post a comment