javascript - How to listen for a JS page load event using intern -


the application under test emits 'page-load' event after every page load , want take screenshot after page has loaded. tried listen event using leadfoot's execute method. not seem work. can point out if there way listen events page-load.

    return remote.get(url)      .execute(function() {                                         window.addeventlistener('page-load',      function() {                                               console.log("page ready");                                         }, false);                                     }, [])     .takescreenshot().then(function(data) {                                         recordimage(newaddress, data);                                     }) 

given event fires asynchronously , want wait proceed until event fires, should use executeasync instead of execute. in addition arguments passed through, executeasync adds callback argument code should call when asynchronous operation completes.

return remote.get(url)  .executeasync(function(done) {     window.addeventlistener('page-load', function() {           done();     }, false); }, []) .takescreenshot().then(function(data) {     recordimage(newaddress, data); }) 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -