consoleイベント(例:console.logイベント)をリスンし、同じものを処理するためのコールバックを登録します。

使用方法

                    .captureBrowserConsoleLogs(onEventCallback)
                

 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');
       }, []);
   });
 });

パラメータ

名前 説明
onEventCallback 関数

新しいコンソールイベントが取得されるたびに呼び出されるコールバック関数。