code: function listenFor(type) {
      return page.evaluateOnNewDocument(type => {
        document.addEventListener(type, e => {
          window.onCustomEvent({type, detail: e.detail});
        });
      }, type);
    }
docs: Attach an event listener to page to capture a custom event on page load/navigation.
  @param {string} type Event name.
  @return {!Promise}