Commit 39d5b661 39d5b661f31616ff663bf4ab17d86484bfce0cec by Nicolas Perriault

added Casper#exists() method to check for a DOM element

1 parent 0e6b9a67
......@@ -306,6 +306,20 @@
},
/**
* Checks if an element matching the provided CSS3 selector exists in
* current page DOM.
*
* @return Boolean
*/
exists: function(selector) {
return self.evaluate(function() {
return __utils__.exists('%selector%');
}, {
selector: selector
});
};
/**
* Fills a form with provided field values.
*
* @param String selector A CSS3 selector to the target form to fill
......
......@@ -41,6 +41,10 @@ phantom.Casper.extend({
return this.assert(pattern.test(subject), message);
},
assertSelectorExists: function(selector, message) {
return this.assert(this.exists(selector), message);
},
assertTitle: function(expected, message) {
return this.assertEvalEquals(function() {
return document.title;
......