Laravel Dusk: Facebook\WebDriver\Exception\UnknownErrorException: unknown error: net::ERR_CONNECTION_REFUSED Laravel Dusk: Facebook\WebDriver\Exception\UnknownErrorException: unknown error: net::ERR_CONNECTION_REFUSED google-chrome google-chrome

Laravel Dusk: Facebook\WebDriver\Exception\UnknownErrorException: unknown error: net::ERR_CONNECTION_REFUSED


I faced the same issue and for me what worked was setting the APP_URL parameter in the .env file as:

APP_URL=http://127.0.0.1:8000

As that was the same port on which my php artisan serve would also serve the website i.e.

Laravel development server started: http://127.0.0.1:8000


I'm putting this out there for others that might face the same thing as me.

It turns out Laravel Dusk expects us to run php artisan serve before running php artisan dusk! The ERR_CONNECTION_REFUSED error refers to not being able to connect to the http://localhost:8000 URL of the application itself, because it's not running.

This does make sense, but I simply didn't know and the documentation was not clear on that (I had to deduce it). The ChromeDriver, however, is started automatically by Dusk at execution time.


Fixed it by following these steps:

  1. Remove vendor folder and remove composer.lock
  2. php composer.phar install
  3. Check your current Chrome Version - you can check it by going to https://www.whatismybrowser.com/detect/what-version-of-chrome-do-i-have
  4. Download the WebDriver for Chrome that matches your current Chrome Version from http://chromedriver.chromium.org/downloads
  5. Manually remove old chromedriver-win.exe version from vendor\laravel\dusk\bin and put the one you downloaded there. Note that you will have to rename the file.

After doing step 2 above the error message changed which prompted the remaining steps.