Protractor is a wrapper around Webdriverjs
, so you should be able to use addEventListener
command to add any browser supported events that will cover most user actions and DOM interrogations
Note, this is only supported in chrome currently
Also, this is an experimental feature in webdriver.js so have to add
var client = WebdriverJS.remote({
logLevel: 'verbose',
experimental: true, // <-- enables browser side eventhandling
desiredCapabilities: {
browserName: 'chrome'
}
});
And then register events like
client
.url('http://google.com')
.addEventListener('dblclick','#hplogo', function(e) {
console.log(e.target); // -> 'id("hplogo")'
console.log(e.type); // -> 'dblclick'
console.log(e.clientX, e.clientY); // -> 239 524
})
.doubleClick('#hplogo') // triggers event
.end();
You can use removeEventListener
to unregister any registered listeners
Evenhandling in Node.js environment is also supported as implied by this
WebdriverJS inherits several function from the NodeJS EventEmitter object
If you want to also capture network traffic , you can do that with browsermob-proxy
Here is a tutorial on browsermob-proxy