Search code examples
internleadfoot

How to get the performance logs in leadfoot internjs?


SImilar to protractor, I'm looking for some info on getting performance logs in leadfoot of internjs.

Below is only an example of getting logs in protractor

browser.manage().logs().get('performance').then(function (browserLog) {
    if (browserLog.length > 0)
         JSON.parse(JSON.stringiy(browserLog)).forEach(function (browserLog) {
         console.log('log: ' + browserLog.message);
     });

Solution

  • Yes, if performance logs are available, you can use Leadfoot's getLogsFor() function. Depends on the environment as far as what types of logs are available. You can use getAvailableLogTypes() to find that out for your use case.

    According to the documentation:

    getLogsFor(type: string): Promise.<Array.<LogEntry>>
    

    Gets all logs from the remote environment of the given type. The logs in the remote environment are cleared once they have been retrieved.