puppeteer#LaunchOptions TypeScript Examples
The following examples show how to use
puppeteer#LaunchOptions.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: puppeteer-core.module.ts From nest-puppeteer with MIT License | 5 votes |
static forRoot(
launchOptions: LaunchOptions = DEFAULT_CHROME_LAUNCH_OPTIONS,
instanceName: string = DEFAULT_PUPPETEER_INSTANCE_NAME,
): DynamicModule {
const instanceNameProvider = {
provide: PUPPETEER_INSTANCE_NAME,
useValue: instanceName,
};
const browserProvider = {
provide: getBrowserToken(instanceName),
async useFactory() {
return await launch(launchOptions);
},
};
const contextProvider = {
provide: getContextToken(instanceName),
async useFactory(browser: Browser) {
return browser.createIncognitoBrowserContext();
},
inject: [getBrowserToken(instanceName)],
};
const pageProvider = {
provide: getPageToken(instanceName),
async useFactory(context: BrowserContext) {
return await context.newPage();
},
inject: [getContextToken(instanceName)],
};
return {
module: PuppeteerCoreModule,
providers: [
instanceNameProvider,
browserProvider,
contextProvider,
pageProvider,
],
exports: [browserProvider, contextProvider, pageProvider],
};
}
Example #2
Source File: puppeteer.constants.ts From nest-puppeteer with MIT License | 5 votes |
args: LaunchOptions['args'] = [
'--allow-insecure-localhost', // Enables TLS/SSL errors on localhost to be ignored (no interstitial, no blocking of requests).
'--allow-http-screen-capture', // Allow non-secure origins to use the screen capture API and the desktopCapture extension API.
'--no-zygote', // https://codereview.chromium.org/2384163002
]
Example #3
Source File: puppeteer.constants.ts From nest-puppeteer with MIT License | 5 votes |
DEFAULT_CHROME_LAUNCH_OPTIONS: LaunchOptions = {
headless: true,
pipe: process.platform !== 'win32',
args,
}