Chrome devtools run snippet to load pages

What i would like to achieve

Using Chrome Canary 65 i would like to use a chrome snippet to load several pages of a website and
for each page

  1. done: get certain urls
  2. done: get timing-values via window.performance.timing
  3. done: create a query string that contains the timing-values (for example ?page=home&loadTime=200&domcontentloaded=500)
  4. fail: reload the same page including the querystring window.location.href = url + queryString
  5. fail: go to the next page

What i tried

This is my code and see also my codepen mock

function testPageLoadTimes()
{
   // step 1  get [] of urls / href-values done
   var linkList = getMainNavigationLinks() 

   // step 2 get timings done
   var timings = getPerformanceTimings();

   // step 3 craft query string done
   let querystring = getQuerystring(timings);        

   // for each link / url do the following fail
   for (var link of linkList) 
   {
       if(document.readyState === 'complete')
       {               
           // let timings = getPerformanceTimings();
           // let querystring = getQuerystring(timings);        
           // fail
           setTimeout(function()
                      {
                          window.location.href=link + querystring}
                       ,6000);
     }
   }  
}

I also tried a recursive approach

function testPage(linkList)
{      
  console.log("link", linkList[0]);        
  if(document.readyState === 'complete')
  {

        let timings = getPerformanceTimings();
        let querystring = getQuerystring(timings); 
        let newUrl = linkList[0]+ querystring;               
        setTimeout(function(){
            console.log(newUrl);
            console.time();
            window.location.href=newUrl;
        },2000);
  }    
  linkList.splice(0, 1);
  testPage(linkList);
}

var linkList = getMainNavigationLinks();
testPage(linkList);

Since i am inexperienced with promises i was unable to make something work using a promise

function loadPage(url) {
  return new Promise((resolve, reject) => {        
    resolve(console.log("foo resolve"));
    reject(console.log("foo reject"));    
  });
}

Question

How can i use a chrome snippet to load the same page and after it has loaded go to the next page?

See my mock on codepen

Edit

I am using chrome canary 65 and regarding execution context my chrome devtool settings have this option

Chrome Canary 65 - Chrome Dev Tools Settings Console

Chrome console: snippet command can’t open dialog

I have a simple oneline snippet to “click” on a «load file» button on a visible page to call a dialog-popup (to load an image, for example).

this.document.getElementsByName("image")[0].click()  // snippet code 

While manual paste and run this line in console is successful (it opens the dialog), the above snippet can’t do that. Seems like Chrome doesn’t allow to open dialog not by user call. So, I set browser to allow all popups but there is no result.

Tested on different pages where file load button presents.

Thanks for any ideas.

A similar but different issue, solved