Skip to content

trouble with each #34

@skaplun

Description

@skaplun

Hey,
sorry I'm bombing you :) thanks for the help so far :)
i ran into another issue,essentially everything works but i get an error on each test at some random point (seems different in each trial):

node : events.js:72
At line:1 char:1
+ node hello3.js
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (events.js:72:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

      listeners[i].call(self);
                  ^
TypeError: Cannot read property 'call' of undefined
    at emitNone (events.js:72:19)
    at SockJSConnection.emit (events.js:166:7)
    at cleanup (C:\Users\shai\node_modules\shoe\index.js:25:20)
    at Session.stream._session.didTimeout (C:\Users\shai\node_modules\shoe\index.js:14:13)
    at Session.timeout_cb [as _onTimeout] (C:\Users\shai\node_modules\sockjs\lib\transport.js:101:22)
    at Timer.listOnTimeout (timers.js:92:15)

My Code:

ph.viewport(1360, 960)
    .open(domain)
    .screenshot(dir + '\\home.png')
    .evaluate(function () {

    return [].filter.call(document.querySelectorAll('a'), function (link) {
       if(link.hostname === document.location.hostname) {
           return link
        }

     }).map(function(link){
       return [link.hostname, link.pathname];
    })

})
.catch(function (e) {
    console.log('error', e);
})
.finally(function (results) {
    console.log('finally!');
    ph.exit();
    return results;

}).each(function(link){
    return scrapUrl(link, dir)
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions