Automated tests 如何在木偶戏中使用chrome配置文件

Automated tests 如何在木偶戏中使用chrome配置文件,automated-tests,puppeteer,Automated Tests,Puppeteer,我无法在木偶戏中使用特定的配置文件。它总是以新用户的身份打开chrome 例如:我的chrome有3个配置文件。以下是我用来在特定配置文件中打开chrome的代码: const browser = await puppeteer.launch({ headless: false, executablePath: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', // args: ['--

我无法在木偶戏中使用特定的配置文件。它总是以新用户的身份打开chrome

例如:我的chrome有3个配置文件。以下是我用来在特定配置文件中打开chrome的代码:

const browser = await puppeteer.launch({
    headless: false,
    executablePath: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe',
    // args: ['--profile-directory="Profile 1"'],
    userDataDir:"C:\\Users\\USER_NAME\\AppData\\Local\\Google\\Chrome\\User Data\\Profile 1"
  });
但它总是以“当前用户”的身份打开chrome。请尝试以下代码:

const browser = await puppeteer.launch({headless:false, args:[
'--user-data-dir=/user/data/directory/profile_n']
});
以下是完整的解释:


如果这解决了你的问题,那么请你好好考虑一下,作为对你问题的回答。