This commit is contained in:
soulgalore 2014-08-26 23:24:56 +02:00
parent d6ffd1b609
commit 04784b37ca
1 changed files with 7 additions and 11 deletions

View File

@ -1,14 +1,11 @@
/**
* Wait until the test condition is true or a timeout occurs. Useful for waiting
* on a server response or for a ui change (fadeIn, etc.) to occur.
*
* @param testFx javascript condition that evaluates to a boolean,
* it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or
* as a callback function.
* @param onReady what to do when testFx condition is fulfilled,
* it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or
* as a callback function.
* @param timeOutMillis the max amount of time to wait. If not specified, 3 sec is used.
* Sitespeed.io - How speedy is your site? (http://www.sitespeed.io)
* Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog
* and other contributors
* Released under the Apache 2.0 License
*/
/** Classic waitFor example from PhantomJS
*/
function waitFor(testFx, onReady, timeOutMillis) {
var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 10000, //< Default Max Timout is 10s
@ -70,7 +67,6 @@ if (phantom.args.length < 4 || phantom.args.length > 7) {
if (status !== 'success') {
console.log('Unable to load the address!');
} else {
var self = this;
waitFor(function() {
// Check in the page if a specific element is now visible
return page.evaluate(function() {