How to use the puppeteer.defaultArgs function in puppeteer

To help you get started, we’ve selected a few puppeteer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flow-typed / flow-typed / definitions / npm / puppeteer_v1.2.x / flow_v0.76.x- / test_puppeteer_v1.2.x_defaultArgs.js View on Github external
it('should complain if passed args', () => {
    // $ExpectError no arguments are expected by function type
    (defaultArgs('testing...'): Array);
  });
});
github flow-typed / flow-typed / definitions / npm / puppeteer_v1.20.x / flow_v0.104.x- / test_puppeteer_v1.20.x_defaultArgs.js View on Github external
it('should complain if passed args', () => {
    // $ExpectError no arguments are expected by function type
    (puppeteer.defaultArgs('testing...'): Array);
  });
});
github flow-typed / flow-typed / definitions / npm / puppeteer_v1.20.x / flow_v0.104.x- / test_puppeteer_v1.20.x_defaultArgs.js View on Github external
it('should return a string array', () => {
    (puppeteer.defaultArgs(): Array);
  });
  it('should complain if passed args', () => {
github GoogleChromeLabs / worker-plugin / test / _page.js View on Github external
export async function evaluatePage (url, matches, timeout = 4000) {
  const args = await puppeteer.defaultArgs();
  const browser = await puppeteer.launch({
    args: [
      ...args,
      '--no-sandbox',
      '--disable-setuid-sandbox',
      '--enable-experimental-web-platform-features'
    ]
  });
  const page = await browser.newPage();
  await page.goto(url);

  try {
    return await new Promise((resolve, reject) => {
      page.on('console', msg => {
        const text = msg.text();
        if (text.match(matches)) {
github binaryage / dirac / scripts / run_old_devtools / index.js View on Github external
(async function() {
  const targetRevision = process.argv[2];
  if (!targetRevision || String(parseInt(targetRevision, 10)) !== targetRevision) {
    console.log('The first argument should be a Chromium revision number, like 338865');
    return;
  }
  const info = await downloadChrome(targetRevision);
  childProcess.exec(`${info.executablePath} --remote-debugging-port=9227 --user-data-dir=user-data-dir about:blank`);
  const browser = await puppeteer.launch({
    executablePath: process.env.CHROMIUM_PATH || CHROMIUM_DEFAULT_PATH,
    dumpio: true,
    defaultViewport: null,
    ignoreDefaultArgs: true,
    args: puppeteer.defaultArgs({
      headless: false,
      args: ['--no-default-browser-check', `--custom-devtools-frontend=http://localhost:9227/devtools/`],
      userDataDir: 'debugging-user-data-dir'
    }).filter(x => !x.startsWith('--enable-automation'))
  });
  const page = (await browser.pages())[0];
  await page.goto('http://localhost:9227');
  const chromeVersion = await page.evaluate(async () => {
    const data = await fetch('json/version');
    const json = await data.json();
    const userAgent = json['User-Agent'];
    const start = userAgent.indexOf('Chrome/') + 'Chrome/'.length;
    return userAgent.substring(start, userAgent.indexOf(' ', start));
  });
  console.log(`Launched Chromium ${chromeVersion}`);
  await page.bringToFront();
github yujiosaka / headless-chrome-crawler / lib / hccrawler.js View on Github external
static defaultArgs() {
    return Puppeteer.defaultArgs();
  }
github berstend / puppeteer-extra / lib / PuppeteerExtra.js View on Github external
defaultArgs() {
    return puppeteer.defaultArgs();
  }