Takes a heap snapshot and saves it in string-serialized JSON format.
Load the snapshot file into Chrome DevTools' Memory tab to inspect.

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

Usage

.takeHeapSnapshot([heapSnapshotLocation], [callback])

Parameters

Name Type description
heapSnapshotLocation
Optional
string

Optional Location where you want to save the generated heap snapshot file.

callback
Optional
function

Optional callback function which is called with the heap snapshot serialized to string as argument.

Returns

Type description
string Heap snapshot serialized into string.

Example

 this.demoTest = function (browser) {
   browser
     .navigateTo('https://www.google.com')
     .takeHeapSnapshot('./snap.heapsnapshot');
 };