Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear console log in browser using protractor

Tags:

protractor

I'm able to retrieve the browser logs using

browser.manage().logs().get('browser').then(function(browserLog) {
   logger.info('log: ' + require('util').inspect(browserLog));
});

referenced from https://github.com/angular/protractor/blob/master/docs/faq.md

Similarly is there a way to clear the browser console logs?

like image 936
S Pat Avatar asked Jun 01 '15 20:06

S Pat


1 Answers

function clearLogs() {
    browser.manage().logs().get('browser');
}

Retrieving the logs the way you do actually clears the collection so that trying to get them immediately after that returns an empty array.

like image 50
Delian Mitankin Avatar answered Jan 04 '23 05:01

Delian Mitankin