我无法在 Puppeteer 中使用特定的配置文件。它总是以新用户的身份打开 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"
});
Run Code Online (Sandbox Code Playgroud)
但它总是以“当前用户”配置文件的形式打开 chrome。