Get the performance metrics from the browser. Metrics collection only begin after enablePerformanceMetrics() command is called.

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

Usage

.getPerformanceMetrics(callback)

Parameters

Name Type description
callback function

Callback function called with an object containing the performance metrics as argument.

Returns

Type description
Promise<object> Metrics collected between the last call to enablePerformanceMetrics() command and this command.

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