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 @@ ...@@ -904,6 +904,23 @@
904 return this.waitFor(function(self) { 904 return this.waitFor(function(self) {
905 return self.exists(selector); 905 return self.exists(selector);
906 }, then, onTimeout, timeout); 906 }, then, onTimeout, timeout);
907 },
908
909 /**
910 * Waits until an element matching the provided CSS3 selector does not exist in
911 * remote DOM to process a next step.
912 *
913 * @param String selector A CSS3 selector
914 * @param Function then The next step to perform (optional)
915 * @param Function onTimeout A callback function to call on timeout (optional)
916 * @param Number timeout The max amount of time to wait, in milliseconds (optional)
917 * @return Casper
918 */
919 waitWhileSelector: function(selector, then, onTimeout, timeout) {
920 timeout = timeout ? timeout : this.defaultWaitTimeout;
921 return this.waitFor(function(self) {
922 return ! self.exists(selector);
923 }, then, onTimeout, timeout);
907 } 924 }
908 }; 925 };
909 926
......