Skip to content

Instantly share code, notes, and snippets.

@techjacker
Last active December 21, 2015 05:39
Show Gist options
  • Save techjacker/6258426 to your computer and use it in GitHub Desktop.
Save techjacker/6258426 to your computer and use it in GitHub Desktop.
phantomjs cannot load component.js apps
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