google-chromepuppeteersafe-browsing

Enable chrome SafeBrowsing error with puppeteer


Google Safe Browsing shows client side warning page when browsing to a malicious web site.

For example, navigating to https://testsafebrowsing.appspot.com/s/malware.html will display: client side warning page

However, when using puppeteer this warning page is not shown.

Is it possible to enable this error screen in puppeteer, or to detect it will be shown if using the browser?

I have tried to:

  1. Use the local Chrome instead of Chromium
  2. set ignoreDefaultArgs to true (run without puppeteer default flags):
  const browser = await puppeteer.launch({
    executablePath: '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome',
    ignoreDefaultArgs: true,
  });
  1. Played with various possible related flags see here

However the warning page was never displayed.


Solution

  • Did you try launching puppeteer with the 'userDataDir' argument? Using a predefined user directory should enable web security capabilities.

    const browser = await puppeteer.launch({
        executablePath: '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome',
        ignoreDefaultArgs: true,
        userDataDir: '/Users/<user>/Library/Application Support/Google/Chrome'
      });