Commit d2a77668 d2a77668b8163f620945ebdd98987865a52a3bbe by Solomon White

add waitWhileSelector()

1 parent f9b9bb39
Showing 1 changed file with 17 additions and 0 deletions
......@@ -904,6 +904,23 @@
return this.waitFor(function(self) {
return self.exists(selector);
}, then, onTimeout, timeout);
},
/**
* Waits until an element matching the provided CSS3 selector does not exist in
* remote DOM to process a next step.
*
* @param String selector A CSS3 selector
* @param Function then The next step to perform (optional)
* @param Function onTimeout A callback function to call on timeout (optional)
* @param Number timeout The max amount of time to wait, in milliseconds (optional)
* @return Casper
*/
waitWhileSelector: function(selector, then, onTimeout, timeout) {
timeout = timeout ? timeout : this.defaultWaitTimeout;
return this.waitFor(function(self) {
return ! self.exists(selector);
}, then, onTimeout, timeout);
}
};
......