zfcsoftware / puppeteer-real-browser

This package is designed to bypass puppeteer's bot-detecting captchas such as Cloudflare. It acts like a real browser and can be managed with puppeteer.
https://www.npmjs.com/package/puppeteer-real-browser
MIT License
622 stars 84 forks source link

Support for using sandbox #142

Closed aumeshm closed 1 month ago

aumeshm commented 1 month ago

Right now, puppeteer real browser only uses the --no-sandbox flag. There should be a setting so we can set the real browser to use sandbox vs --no-sandbox

zfcsoftware commented 1 month ago

ignoreAllFlags: true https://github.com/GoogleChrome/chrome-launcher?tab=readme-ov-file#api You can turn it off by adding the defaultFlags here again. However, I cannot turn it off to avoid problems when running with Docker. You can follow the steps I forwarded to turn it off. it doesn't just use the ol flag. It uses many flags. You can visit the link for details.

aumeshm commented 1 month ago

@zfcsoftware losing the default flags just to turn off --no-sandbox may be undesirable. What are the implications here of turning off all flags, seeing that's the only way to turn off --no-sandbox right now.

Is it worth to have a param: enableSandbox?

zfcsoftware commented 1 month ago

@zfcsoftware losing the default flags just to turn off --no-sandbox may be undesirable. What are the implications here of turning off all flags, seeing that's the only way to turn off --no-sandbox right now.

Is it worth to have a param: enableSandbox?

When running with Docker, the browser cannot start if --no-sandbox is not used. I can't remove it for compatibility reasons. I've added the default arguments below. You can add the following arguments to the args value using ignoreAllFlags.

[
  '--disable-extensions',
  '--disable-component-extensions-with-background-pages',
  '--disable-background-networking',
  '--disable-client-side-phishing-detection',
  '--disable-sync',
  '--metrics-recording-only',
  '--disable-default-apps',
  '--mute-audio',
  '--no-default-browser-check',
  '--no-first-run',
  '--disable-backgrounding-occluded-windows',
  '--disable-renderer-backgrounding',
  '--disable-background-timer-throttling',
  '--disable-ipc-flooding-protection',
  '--password-store=basic',
  '--use-mock-keychain',
  '--force-fieldtrials=*BackgroundTracing/default/',
  '--disable-hang-monitor',
  '--disable-prompt-on-repost',
  '--disable-domain-reliability',
  '--propagate-iph-for-testing',
  '--start-maximized',
  '--disable-features=Translate,OptimizationHints,MediaRouter,DialMediaRouteProvider,CalculateNativeWinOcclusion,InterestFeedContentSuggestions,CertificateTransparencyComponentUpdater,AutofillServerCommunication,PrivacySandboxSettings4,AutomationControlled',
  '--no-sandbox'
]
aumeshm commented 1 month ago

fair enough thank you!