Over the last week I’ve started getting an error when running Laravel Dusk in my CI/CD pipeline (GitHub Actions specifically), but the tests would pass locally and even occasionally in CI/CD. This error is now getting more frequent and persistent, and looks like this:
RuntimeException: Invalid path to Chromedriver [/home/runner/work/rapidradiocodes/rapidradiocodes/vendor/laravel/dusk/src/Chrome/../../bin/chromedriver-linux]. Make sure to install the Chromedriver first by running the dusk:chrome-driver command. in /home/runner/work/rapidradiocodes/rapidradiocodes/vendor/laravel/dusk/src/Chrome/ChromeProcess.php:56
Up until now I had been using the following command in my GitHub Actions workflow to automatically grab the Chromedriver version of the currently installed Chrome version, without any problems:
php artisan dusk:chrome-driver `/usr/bin/google-chrome --version | cut -d " " -f3 | cut -d "." -f1`
…but it seems this is no longer enough. How can I fix this?
2
Answers
This is a known bug recently introduced to Dusk and affecting how it downloads the latest version of the ChromeDriver. The bug has been fixed and pushed but is yet to be merged, and as such will not yet be available in the latest version of Dusk. As is usually the case for bugs like this the workaround until that happens is to temporarily hardcode the downloaded ChromeDriver version to the previous working version, 126:
Once the current bug has been merged into the latest version of Dusk, it should be fine to switch back to using something like this:
...or just omit the version number entirely to always get the latest version:
This has been fixed with version 8.2.2 which was released 2 weeks ago.
Just validated this today with version 8.2.3.