從瀏覽器取得效能指標。指標收集只在呼叫 enablePerformanceMetrics() 命令後開始。

用法

                    .getPerformanceMetrics(callback)
                

範例

 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);
         }
       });
   });
 });

參數

名稱 類型 描述
callback function

使用包含效能指標的物件作為參數呼叫的回呼函式。

返回

類型 描述
Promise<object>

在上次呼叫 enablePerformanceMetrics() 命令和此命令之間收集的指標。