protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Subsequent calls to browser.manage().logs().get('browser') always yield empty array responses

Open justusromijn opened this issue 10 years ago • 3 comments

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

justusromijn avatar Apr 04 '16 11:04 justusromijn

Confirmed - this looks like an issue with selenium or chromedriver. I submitted a bug at https://github.com/SeleniumHQ/selenium/issues/1914

juliemr avatar Apr 04 '16 17:04 juliemr

Do you have any workaround for this one? Im also having same issue.

cor03rock avatar Nov 26 '19 09:11 cor03rock

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).

justusromijn avatar Nov 26 '19 21:11 justusromijn