Summer Sale! All accounts are 50% off this week.

alexh's avatar
Level 5

Laravel Dusk: cannot find Chrome binary

Hello everyone,

I am trying to setup my local laravel dusk. But when I run php artisan dusk I get the following error message:

Facebook\WebDriver\Exception\UnknownErrorException: unknown error: cannot find Chrome binary

I have tried the following steps to fix the error:

php artisan dusk:chrome-driver

php artisan dusk:chrome-driver --detect

Installed chrome binary through homebrew

Installed chrome binary through a manual download and adding it manually to the path.

Restarted the terminal everytime. But the error message did not change.

Is there any configuration step I might have missed on my local mac?

0 likes
2 replies
LaryAI's avatar
LaryAI
AI
Best Answer
Level 58

This error occurs when Laravel Dusk is unable to locate the Chrome binary. One solution is to specify the path to the Chrome binary in the Dusk configuration file.

To do this, create a new file named dusk.php in the tests directory and add the following code:

<?php

use Facebook\WebDriver\Chrome\ChromeOptions;

$options = (new ChromeOptions())->addArguments([
    '--disable-gpu',
    '--headless',
    '--no-sandbox',
]);

$options->setBinary('/Applications/Google Chrome.app/Contents/MacOS/Google Chrome');

return [
    'driver' => 'chrome',
    'chromeOptions' => $options,
];

Make sure to replace the path to the Chrome binary with the correct path on your machine.

Alternatively, you can try installing the ChromeDriver binary using Homebrew:

brew install chromedriver

Then, run the following command to update the Dusk configuration:

php artisan dusk:chrome-driver

If neither of these solutions work, try updating Laravel Dusk to the latest version.

1 like
alexh's avatar
Level 5

After reinstalling google chrome it is working now.

Please or to participate in this conversation.