-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Chrome process stopped before startup completed. #610
Comments
Is this I also never managed to reproduce the |
No, it's just in theory. Maybe there is a way to ask chrome through websocket when it's ready to work (booted)
I immediately faced it when added I'll try to investigate more time into this issue as soon as I'll closely work with it |
I have the same problem on Cent OS, fixed it by REinstalling Chrome via this instruction https://linuxize.com/post/how-to-install-google-chrome-web-browser-on-centos-7/ |
Can you guys make a full reproducible example? I am unable to reproduce it on Windows 10 + PHP 8.3.4 + chrome-php/chrome v1.10.0 + Google Chrome 122.0.6261.129 with the code <?php
declare(strict_types=1);
require_once __DIR__ . "/vendor/autoload.php";
$browserFactory = new \HeadlessChromium\BrowserFactory(
"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
);
$userDataDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'chrome_php_issue_610';
echo "User data dir: " . $userDataDir . PHP_EOL;
if (file_exists($userDataDir)) {
echo "Removing user data dir" . PHP_EOL;
shell_exec('rmdir /s /q ' . escapeshellarg($userDataDir));
}
mkdir($userDataDir);
$browser = $browserFactory->createBrowser([
'headless' => !true,
'userDataDir' => $userDataDir,
]);
$page = $browser->createPage();
$page->navigate('https://example.com/')->waitForNavigation(); outputs:
and just as expected, chromium visits example.com without any problem 🤔 |
RuntimeException Chrome process stopped before startup completed😒 |
Can you provide your |
can any of you guys write a reproducible example? I am also unable to reproduce this on Linux Ubuntu 24.04-beta PHP8.3.0 Chromium 122.0.6261.128 chrome-php/chrome v1.11.0 with the code: <?php
declare(strict_types=1);
require_once __DIR__ . "/vendor/autoload.php";
$browserFactory = new \HeadlessChromium\BrowserFactory('chromium-browser');
$userDataDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'chrome_php_issue_610';
echo "User data dir: " . $userDataDir . PHP_EOL;
if (file_exists($userDataDir)) {
echo "Removing user data dir" . PHP_EOL;
shell_exec('rm -rfv ' . escapeshellarg($userDataDir));
}
mkdir($userDataDir);
$browser = $browserFactory->createBrowser([
'headless' => !true,
'userDataDir' => $userDataDir,
]);
$page = $browser->createPage();
$page->navigate('https://example.com/')->waitForNavigation(\HeadlessChromium\Page::NETWORK_IDLE);
|
Sure. Here is my example
That's all, after browser launch it is immediately throwing And here is my debug log with
For clarification: Browser still opened and alive after exception is thrown. It's not crashed, freezed or something like that, it's totally fine 😄 One more thing: This exception throws only when keepAlive = true, maybe because php loses process when it tries to run next command Maybe some thoughts above will be interested for you @enricodias |
Is there any solution or workaround for this? |
As I mentioned earlier: do not use |
Using option userDataDir causes
RuntimeException Chrome process stopped before startup completed.
Sometimes can be tricked with 'connectionDelay' => 100,
As I understood, issue caused because script trying to execute next command before browser fully booted.
So can we somehow handle browser
boot finished
event to prevent executing scripts before boot is done?The text was updated successfully, but these errors were encountered: