code: function check_header() {
                                  // PhantomJS doesn't arrow functions.
                                  page.evaluate(function() {
                                      return document.getElementsByClassName("comment-section-header-renderer").length;
                                  }).then((res) => {
                                      if (res != 0) {
                                          resolve();
                                      } else {
                                          setTimeout(check_header, 1000);
                                      }
                                  }).catch(reject);
                              }
docs: Check header information has been loaded. If not, wait 1000 msec and try again, until loading is finished.