laravel / dusk

Laravel Dusk provides simple end-to-end testing and browser automation.
https://laravel.com/docs/dusk
MIT License
1.86k stars 322 forks source link

[7.9.1] unknown error: cannot find Chrome binary #1046

Closed GC-Mark closed 1 year ago

GC-Mark commented 1 year ago

Dusk Version

7.9.1

Laravel Version

10.16.1

PHP Version

8.2.7

PHPUnit Version

10.2.6

Database Driver & Version

No response

Description

I upgraded from 7.7.1 to 7.9.1 and now all my tests fail with the error...

UnknownErrorException   unknown error: cannot find Chrome binary
   FAILED  Tests\Browser\App\Http\Livewire\Modals\FollowTest > we can update follow button after a succ…  UnknownErrorException   
  unknown error: cannot find Chrome binary

  at vendor/php-webdriver/webdriver/lib/Exception/WebDriverException.php:146
    142▕                     throw new UnexpectedAlertOpenException($message, $results);
    143▕                 case 'unknown command':
    144▕                     throw new UnknownCommandException($message, $results);
    145▕                 case 'unknown error':
  ➜ 146▕                     throw new UnknownErrorException($message, $results);
    147▕                 case 'unknown method':
    148▕                     throw new UnknownMethodException($message, $results);
    149▕                 case 'unsupported operation':
    150▕                     throw new UnsupportedOperationException($message, $results);

      +3 vendor frames 
  4   tests/DuskTestCase.php:92
      +1 vendor frames 
  6   tests/Browser/app/Http/Livewire/Modals/FollowTest.php:114
User git:(master) ✗ artisan dusk:chrome-driver                                                            
ChromeDriver binary successfully installed for version 115.0.5790.102.

Running on an M1 Mac Studio if that makes any difference!?

//cc @crynobone

Steps To Reproduce

See above

RhysLees commented 1 year ago

Was literally just about to post this, i have the same issue:

image

Although i have been having issues since chrome 115+

Im on M2

crynobone commented 1 year ago

It's a known bug (I can confirmed in Mac) and can only be fixed upstream: https://groups.google.com/g/chromedriver-users/c/PXWZDEx6KKE

In the meantime I would recommend downloading Chrome for Testing for your platform.

https://developer.chrome.com/blog/chrome-for-testing/

GC-Mark commented 1 year ago

Thanks for the info @crynobone 👍

driesvints commented 1 year ago

Thanks all

arwinvdv commented 1 year ago

I added this to my DuskTestCase.php driver() function and for now it works:

 if (PHP_OS === 'Darwin') {
    $options->setBinary('/Applications/Google Chrome.app/Contents/MacOS/Google Chrome');
}