Skip to content

Bug: On macOS, Chrome briefly appears in the Dock when starting a headless browser #715

@nextend

Description

@nextend

When using chrome-php to launch a headless Chrome instance on macOS, the Chrome app briefly shows in the Dock during startup. This is unexpected for headless operation and can be disruptive in environments where the Dock visibility should not change (e.g., during screen recordings, kiosk apps, or automated test runners on a developer workstation).

OSX 15.7.1
Chrome 140

$browserFactory = new BrowserFactory();
$browser = $browserFactory->createBrowser(array(
	'headless'                => true,
	'ignoreCertificateErrors' => true,
	'disableNotifications'    => true,
	'windowSize'              => [
		1000,
		1000
	],
	'customFlags'             => [
		'--remote-allow-origins=http://127.0.0.1'
	],
	'args'                    => [
		'--no-crashpad',
		'--disable-dev-shm-usage',
		'--disable-gpu',
		'--headless',
		'--disable-software-rasterizer',
		'--no-sandbox',
		'--crashpad-database=/var/www/.local/crashpad'
	],
));

$page = $browser->createPage();

$page->setViewport($windowWidth, $windowHeight);

$page->addPreScript('window.confirm = window.alert = function() {};');

$page->navigate($url)
		   ->waitForNavigation(Page::LOAD, 25000);

usleep(100000); // wait 100ms for proper screenshot


$screenshot = $page->screenshot();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions