Search code examples
google-chromegoogle-chrome-headlesslighthouse

Closing the first tap when launching chrome which is a local path


I wanna close the first tap and leave only the blank tap Here's a pic showing what i mean . untitled

Here's my code

const fsExtra = require('fs-extra')
const chromeLauncher = require('lighthouse/chrome-launcher/chrome-launcher');
const CDP = require('chrome-remote-interface');
const fs = require('fs');
const windowWidth = 6200;
const windowHeight = 6060;

headless=false
const launchConfig = {
    chromeFlags: [
        `--window-size=${windowWidth},${windowHeight}`,
        '--disable-gpu',
     headless ? '--headless' : ''
     ]
}

async function launchChrome(headless = true) {
  return await chromeLauncher.launch(launchConfig);
}

const chrome =  launchChrome();
console.log(chrome)

Solution

  • The problem was in the launchConfig, there's :'' after headless and that's what cause the behavior of opening the an extra tab.

    So, the solution is removing :''