admc / wd

A node.js client for webdriver/selenium 2.
Other
1.53k stars 402 forks source link

browser.on('log') ? #232

Closed binarykitchen closed 10 years ago

binarykitchen commented 10 years ago

We already have browser.on('status', ... and browser.on('command', ... but what about logging?

I think it would be extremely helpful to see browser outputs of console.log as well. Sometimes I debug for hours for a small bug. If I could see those logs, I'd save lots of time.

sebv commented 10 years ago

It's not possible, at wd level. In theory it should be possible to get it in the driver log, but last time I tried I couldn't get it to work in Chrome.

Best is to isolate your test and add a sleep before quit, so you have time to open the browser console directly.

binarykitchen commented 10 years ago

Hmmm, cannot do this when I run my e2e tests with PhantomJS ...

sebv commented 10 years ago

You can get the browser console in the phantomjs log, pretty sure.

binarykitchen commented 10 years ago

Yeah, that's possible. Well, I am using this module https://github.com/jmreidy/grunt-mocha-webdriver ... no idea if they expose a PhantomJS instance directly.

sebv commented 10 years ago

wow phantomjs --webdriver=4444 is awesome.

Seems there was some work on the browser console recently https://github.com/detro/ghostdriver/pull/275. As far as I understand you will get the log via the wd/jsonwire log method, but it hasn't been pulled yet to the npm version of phantomjs.

binarykitchen commented 10 years ago

Wonderful, this is great! Will wait patiently until this is on npm ...

sebv commented 10 years ago

closing, not really a wd issue.