Listen to the console events (ex. console.log event) and register callback to process the same.

Usage

                    .captureBrowserConsoleLogs(onEventCallback)
                

Example

 describe('capture console events', function() {
   it('captures and logs console.log event', function() {
     browser
       .captureBrowserConsoleLogs((event) => {
         console.log(event.type, event.timestamp, event.args[0].value);
       })
       .navigateTo('https://www.google.com')
       .executeScript(function() {
         console.log('here');
       }, []);
   });
 });

Parameters

Name Type description
onEventCallback function

Callback function called whenever a new console event is captured.