danielcardeenas/sulla

Feature Request: Adding options for setting executablePath puppeteer option

fatihky opened this issue · 0 comments

Hi, it seems sulla.create() doesn't have any option for setting a custom chrome/chromium executable path which is provided by puppeteer. We can pass a custom executable path via executablePath options. Fore more information, see https://github.com/puppeteer/puppeteer#default-runtime-settings.

It seems initBrowser method accepts extra argument which can be used to pass executablePath option, but that argument is not exposed to outside.
Here is initBrowser method:

async function initBrowser(
session: string,
options: CreateConfig,
extras = {}
) {
if (options.useChrome) {
const chromePath = getChrome();
if (chromePath) {
extras = { ...extras, executablePath: chromePath };
} else {
console.log('Chrome not found, using chromium');
extras = {};
}
}
// Use stealth plugin to avoid being detected as a bot
puppeteer.use(StealthPlugin());
const browser = await puppeteer.launch({
// headless: true,
headless: options.headless,
devtools: options.devtools,
userDataDir: path.join(process.cwd(), session),
args: options.browserArgs
? options.browserArgs
: [...puppeteerConfig.chroniumArgs],
...extras,
});
return browser;
}

Could you allow us to set executablePath option or expose extra argument to outside? It'd be so helpful for me. I need to set custom chrome path in order to avoid downloading chromium (I have to count my internet usage, unfortunately).

By the way, setting a custom executable path can be done with PUPPETEER_EXECUTABLE_PATH environment variable, too. See: https://github.com/puppeteer/puppeteer/blob/v5.3.0/docs/api.md#environment-variables
So setting executablePath option is not mandatory.