chrome-php / chrome

Instrument headless chrome/chromium instances from PHP
MIT License
2.2k stars 269 forks source link

How to disable userDataDir and userCrashDumpsDir ? #621

Open phpmooc opened 2 months ago

phpmooc commented 2 months ago

Is it possible to disable user data dir and user crash dir ?
if so, how to configure? I tried the the config options both userDataDir and userCrashDumpsDir, and then checked out the repo codes, it seems not work.

qzw881130 commented 3 weeks ago

i'm not sure. but you can give it a shot.

you can use "excludedSwitches" paramater.

my code:

            'excludedSwitches' => ['--enable-crash-reporter'],
        $options = [
            'keepAlive' => true,
            'headless' => true,
            'startupTimeout' => 35,
            'connectionDelay' => 0.8,
            'sendSyncDefaultTimeout' => self::TimeOut,
            //  'debugLogger'     => 'php://stdout',
            'enableImages' => $enableImages,
            'excludedSwitches' => ['--enable-crash-reporter'],
            'customFlags' => ['--eshop_id=' . $this->eshop->id, '--chrome-coupon', '--disable-crash-reporter']
        ];