amtrack / sfdx-browserforce-plugin

sfdx plugin for browser automation
MIT License
109 stars 37 forks source link

Ability to use different browser for execution #557

Closed strotto closed 1 year ago

strotto commented 1 year ago

Hi, would it be possible to add an environment variable to allow users to specify an existing browser to run instead of using Chromium which is packaged with puppeteer? We have strict access controls on our enterprise laptops where only whitelisted applications can be run, and unfortunately Chromium isn't one of them. I am able to edit the code in browserforce.js to launch my existing Chrome install instead.

amtrack commented 1 year ago

Hi @strotto This is already possible and I'm using this approach already for a client.

It is difficult to find in the puppeteer docs. But this is a puppeteer native configuration and environment variable: https://pptr.dev/faq/#q-chromium-gets-downloaded-on-every-npm-ci-run-how-can-i-cache-the-download

# optionally to speed up the installation if you don't want to use the bundled chromium
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true

# install sfdx-browserforce-plugin e.g.
sfdx plugins:install sfdx-browserforce-plugin

# This is the key
export PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser

# run the plugin the same way as before
sfdx browserforce:apply -f path/to/config.json
...
strotto commented 1 year ago

Legend, worked like a charm