Commit cfd9bca2 cfd9bca2a142f07755ee234f8bacd137622fcbd3 by reina.sweet

querySelector interface.

1 parent df1e5cc3
......@@ -936,6 +936,32 @@ Casper.prototype.open = function open(location, settings) {
};
/**
* Retrieves a DOM element matching the provided CSS3 selector.
*
* @param String selector A CSS3 selector
* @return HTMLElement The requested DOM element
*/
Casper.prototype.querySelector = function querySelector(selector) {
"use strict";
return this.evaluate(function _evaluate(selector) {
return window.querySelector(selector);
}, { selector: selector });
};
/**
* Retrieves a NodeList of DOM elements matching the provided CSS3 selector.
*
* @param String selector A CSS3 selector
* @return HTMLElement[] The requested NodeList of DOM elements
*/
Casper.prototype.querySelectorAll = function querySelectorAll(selector) {
"use strict";
return this.evaluate(function _evaluate(selector) {
return window.querySelectorAll(selector);
}, { selector: selector });
};
/**
* Reloads current page.
*
* @param Function then a next step function
......