While running following command
php artisan dusk
Gives the chrome binary not found error:
jaygaha@JGAHA:~/workspace/playground/laravel-dusk$ php artisan dusk
PHPUnit 9.5.13 by Sebastian Bergmann and contributors.
E 1 / 1 (100%)
Time: 00:02.059, Memory: 20.00 MB
There was 1 error:
1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\UnknownErrorException: unknown error: cannot find Chrome binary
/home/jaygaha/workspace/playground/laravel-dusk/vendor/php-webdriver/webdriver/lib/Exception/WebDriverException.php:139
/home/jaygaha/workspace/playground/laravel-dusk/vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php:372
/home/jaygaha/workspace/playground/laravel-dusk/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php:131
/home/jaygaha/workspace/playground/laravel-dusk/tests/DuskTestCase.php:46
/home/jaygaha/workspace/playground/laravel-dusk/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:219
/home/jaygaha/workspace/playground/laravel-dusk/vendor/laravel/framework/src/Illuminate/Support/helpers.php:234
/home/jaygaha/workspace/playground/laravel-dusk/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:220
/home/jaygaha/workspace/playground/laravel-dusk/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:98
/home/jaygaha/workspace/playground/laravel-dusk/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:66
/home/jaygaha/workspace/playground/laravel-dusk/tests/Browser/ExampleTest.php:21
ERRORS!
Tests: 1, Assertions: 0, Errors: 1.
This is due to Chrome browser is not installed, you need to install it first in your system:
Ubuntu
OS on Windows Subsystem Linux
Make sure you're up to date first with dependencies:
sudo apt update && sudo apt -y upgrade
Download and install Chrome:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt -y install ./google-chrome-stable_current_amd64.deb
Check that it's installed ok:
google-chrome --version
Once the installation is done and run laravel dusk command:
jaygaha@JGAHA:~/workspace/playground/laravel-dusk$ php artisan dusk
PHPUnit 9.5.13 by Sebastian Bergmann and contributors.
. 1 / 1 (100%)
Time: 00:07.191, Memory: 20.00 MB
OK (1 test, 1 assertion)
It shall work now. Hope this helps.