Take heap snapshot and save it as a .heapsnapshot file.
The saved snapshot file can then be loaded into Chrome DevTools' Memory tab for inspection.

The contents of the heap snapshot are also available in the value property of the result
argument passed to the callback, in string-serialized JSON format.

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

Usage

                    .takeHeapSnapshot([heapSnapshotLocation], [callback])
                

Example

 describe('take heap snapshot', function() {
   it('takes heap snapshot and saves it as snap.heapsnapshot file', function() {
     browser
       .navigateTo('https://www.google.com')
       .takeHeapSnapshot('./snap.heapsnapshot');
   });
 });

Parameters

Name Type description
heapSnapshotLocation
Optional
string

Location where the generated heap snapshot file should be saved.

callback
Optional
function

Callback function called with string-serialized heap snapshot as argument.

Returns

Type description
Promise<string>

Heap snapshot in string-serialized JSON format.