Subsequent calls to browser.manage().logs().get('browser') always yield empty array responses
I have found that multiple calls to browser.manage().logs() do not work as documented. The first call yields some results of my browser log (of course only errors / warnings, I know that by default info / debug is ignored). However, if I do subsequent calls, the logs are always an empty array even though I create new console errors between the first and the second call.
Snippet of tests:
describe("when something unavailable", function() {
beforeEach(function() {
browser.get('/somepage.html');
});
it('shows logging', function(){
browser.manage().logs().get('browser').then(function(logs){
// logs is an array with a couple of items here...
});
browser.sleep(5000).then(function(){
browser.manage().logs().get('browser').then(function(logs){
// no logs here?
});
})
});
});
Snippet of somepage:
console.error('Whaa!'); // this is found by protractor
setTimeout(function(){
console.error('Whoo!'); // this is never found
}, 2000);
Bug report
- Node Version:
5.7.0 - Protractor Version:
3.1.1 - Browser(s):
Chrome - Operating System and Version
Mac OS 10.11.2
Confirmed - this looks like an issue with selenium or chromedriver. I submitted a bug at https://github.com/SeleniumHQ/selenium/issues/1914
Do you have any workaround for this one? Im also having same issue.
The problem lies in the webdriver implementation themselves, so no solution from protractor or selenium. You basically have one call to the browserlogs, so postpone that call as long as you can (to avoid missing out on logs).