Last active
December 21, 2015 05:39
-
-
Save techjacker/6258426 to your computer and use it in GitHub Desktop.
phantomjs cannot load component.js apps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var page = require('webpage').create(); | |
// search div is added after ajax call has been made | |
// but with phantom driving the ajax call never runs | |
var waitForAjaxToLoad = function () { | |
return (document.getElementById('search') != null); | |
}; | |
page.open('http://component.io/', function (status) { | |
if (status !== "success") { | |
console.log("Unable to access network"); | |
} else { | |
window.setTimeout(function () { | |
// returns false | |
var res = page.evaluate(waitForAjaxToLoad); | |
console.log("res: " + res); | |
phantom.exit(); | |
}, 2000); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment