Open matthewcheok opened 11 years ago
I'm trying to grab the html when AJAX operations are complete with some client javascript like this:
var evt = document.createEvent('Event'); evt.initEvent('__htmlReady__', true, true); document.dispatchEvent(evt);
I'm listening for events like this:
page.onCallback = function() { page.get('content', function(err, html) { ph.exit(); console.log(html); }); }; page.onInitialized = function() { page.evaluate(function() { document.addEventListener('__htmlReady__', function() { window.callPhantom(); }, false); setTimeout(function() { window.callPhantom(); }, 10000); }); };
But the event never triggers, only the timeout triggers. This issue doesn't happen when I run phantomjs from the command line.
Any ideas?
Hmm, hard to tell without an example setup where I can try to reproduce it - it could be many things I guess.
I'm trying to grab the html when AJAX operations are complete with some client javascript like this:
I'm listening for events like this:
But the event never triggers, only the timeout triggers. This issue doesn't happen when I run phantomjs from the command line.
Any ideas?