我需要使用 NodeJS 在 Puppeteer 中使用现有的 Firefox 配置文件。该配置文件具有我需要的历史记录、配置的附加组件、代理服务器和 cookie。
您可以设置 userDataDir 选项
First you need to get your profile data
/////////////////////////////////////////////////////////////////////
Choose the temporary profile created via Puppeteer
const users_path = " C:/Users/UserName.../AppData/Local/Temp/puppeteer_dev_profile"
const profile = "kv3GXU"
const userDataDir = `${users_path}-${profile}`
//${users_path}-${profile} // "-" between paths
or choose your created one
const users_path = "C:/Users/UserName.../AppData/Roaming/Mozilla/Firefox/Profiles"
const profile = "z2tdrs4e.Karim"
const userDataDir = `${users_path}/${profile}`
//${users_path}/${profile} // "/" between paths
set userDataDir to options
const browser = await puppeteer.launch({
product: "firefox",
userDataDir
});
/////////////////////////////////////////////////////////////////////
it's work fine with me but i can't use firefox Beta/Release i can only use firefox nightly
So I left puppeteer and I'm currently using selenium in Node JS, it can run all firefox browsers and choose profile easily