Protractor Logging – console output – print to log file

Protractor Console output

As protractor is built on top of webdriver JS, we should resolve promise while printing to console output.

so below statement doesn’t work

console.log("Browser title :- " + browser.gettitle());

instead, you can use

browser.getTitle().then(function(txt){
console.log("Browser Title :- " + txt);
});

watch details here

Protractor log to file

As protractor is a node package, there are several loggers are available, in which log4js is one of them

log4js.json

log4jsconfig.ts

test script

 

Content posted is based on learning or working experience,
Share the post with others if find useful,
Any queries?, leave comments or discuss on our facebook:qavalidation.com, Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *