Listen to the console.log events and register callbacks to process the event.

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

Usage

.captureBrowserConsoleLogs(callback)

Parameters

Name Type description
callback function

Callback function to be called when a new log is captured.

Example

 this.demoTest = function (browser) {
   browser
     .captureBrowserConsoleLogs((event) => {
       console.log(event.type, event.timestamp, event.args[0].value);
     })
     .navigateTo('https://www.google.com')
     .executeScript(function() {
       console.error('here');
     }, []);
 };

Recommended content