-1

I want to print console error with response code 4xx or 5xx in a logger file while executing automation script in protractor. Now I am using the following code in my afterEach. It prints everything from the console.

browser.manage().logs().get('browser').then(function(browserLog) {
   console.log('log: ' + require('util').inspect(browserLog));
});
Ivan Kaloyanov
  • 1,748
  • 6
  • 18
  • 24
Ram
  • 11
  • 5

1 Answers1

0

Thr protractor tests, are executed over node, so you can use node's file system ('fs' module) commands.

for example the appendFile methode How to append to a file in Node?

Michael R.
  • 388
  • 3
  • 9