Skip to content

Latest commit

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

This example is to be used with the Browserless template

Create two reference variables on your Railway service that you deploy your app to -

BROWSER_WEBDRIVER_ENDPOINT=${{Browserless.BROWSER_WEBDRIVER_ENDPOINT}}
BROWSER_TOKEN=${{Browserless.BROWSER_TOKEN}}

Then use process.env.BROWSER_WEBDRIVER_ENDPOINT and process.env.BROWSER_TOKEN in code

Before

constchromeCapabilities=webdriver.Capabilities.chrome();// Set args similar to puppeteer's for best performancechromeCapabilities.set('goog:chromeOptions',{args: ['--window-size=1920,1080','--disable-background-timer-throttling','--disable-backgrounding-occluded-windows','--disable-breakpad','--disable-component-extensions-with-background-pages','--disable-dev-shm-usage','--disable-extensions','--disable-features=TranslateUI,BlinkGenPropertyTrees','--disable-ipc-flooding-protection','--disable-renderer-backgrounding','--enable-features=NetworkService,NetworkServiceInProcess','--force-color-profile=srgb','--hide-scrollbars','--metrics-recording-only','--mute-audio','--headless','--no-sandbox',],});constdriver=newwebdriver.Builder().forBrowser('chrome').withCapabilities(chromeCapabilities).build();

After

constchromeCapabilities=webdriver.Capabilities.chrome();chromeCapabilities.set('browserless:token',process.env.BROWSER_TOKEN);// Set args similar to puppeteer's for best performancechromeCapabilities.set('goog:chromeOptions',{args: ['--window-size=1920,1080','--disable-background-timer-throttling','--disable-backgrounding-occluded-windows','--disable-breakpad','--disable-component-extensions-with-background-pages','--disable-dev-shm-usage','--disable-extensions','--disable-features=TranslateUI,BlinkGenPropertyTrees','--disable-ipc-flooding-protection','--disable-renderer-backgrounding','--enable-features=NetworkService,NetworkServiceInProcess','--force-color-profile=srgb','--hide-scrollbars','--metrics-recording-only','--mute-audio','--headless','--no-sandbox',],});constdriver=newwebdriver.Builder().forBrowser('chrome').withCapabilities(chromeCapabilities).usingServer(process.env.BROWSER_WEBDRIVER_ENDPOINT).build();

The rest of your JS/TS code remains the same with no other changes required.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages