Skip to content

Commit

Permalink
add debug logging around page events
Browse files Browse the repository at this point in the history
  • Loading branch information
jesg committed Jul 29, 2017
1 parent ee50ba9 commit 0cf2d01
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion lib/core/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,33 @@ var Driver = function (crd) {
}

Driver.prototype.init = function () {
const self = this
debug('init')
return Promise.all([
this.Page.enable(),
this.DOM.enable(),
this.Runtime.enable(),
this.Network.enable()
])
]).then(() => {
const event_names = [
'Page.domContentEventFired',
'Page.loadEventFired',
'Page.frameAttatched',
'Page.frameNavigated',
'Page.frameDetached',
'Page.frameStartedLoading',
'Page.frameStoppedLoading',
'Page.frameScheduledNavigation',
'Page.navigationRequested'
]
for (let i in event_names) {
const name = event_names[i]
self.crd.on(name, (result) => {
debug(name + ': '+ JSON.stringify(result))
})
}
return self
})
}

/**
Expand Down

0 comments on commit 0cf2d01

Please sign in to comment.