Enable/disable the collection of performance metrics in the browser. Metrics collection only begin after this command is called.

enablePerformanceMetrics() is only available when using Chrome or Edge drivers.

Usage

.enablePerformanceMetrics([enable], [callback])

Parameters

Name Type description
enable
Optional
boolean

Whether to enable or disable the performance metrics collection. Default: true.

callback
Optional
function

callback function to be called when the command finishes.

Example

 describe('collect performance metrics', function() {
   it('enables the metrics collection, does some stuff and collects the metrics', function() {
     browser
       .enablePerformanceMetrics()
       .navigateTo('https://www.google.com')
       .getPerformanceMetrics((result) => {
         if (result.status === 0) {
           const metrics = result.value;
           console.log(metrics);
         }
       });
   });
 });

Recommended content