symfony / panther

A browser testing and web crawling library for PHP and Symfony
MIT License
2.94k stars 222 forks source link

Getting error: unknown error: cannot find Chrome binary #564

Closed agonyz closed 2 years ago

agonyz commented 2 years ago

Configuration

Error

I get the following error when I try to use Symfony Panther:

unknown error: cannot find Chrome binary

I tried using it the following ways:

1. Via Composer require

composer require --dev dbrekelmans/bdi vendor/bin/bdi detect drivers

I get the following warnings in the console:

Deprecated: Return type of HumbugBox385\KevinGH\RequirementChecker\RequirementCollection::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should
 be used to temporarily suppress the notice in phar:///shared/httpd/monitoring/vendor/dbrekelmans/bdi/bdi/.box/src/RequirementCollection.php on line 15

Deprecated: Return type of HumbugBox385\KevinGH\RequirementChecker\RequirementCollection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily supp
ress the notice in phar:///shared/httpd/monitoring/vendor/dbrekelmans/bdi/bdi/.box/src/RequirementCollection.php on line 19

Deprecated: Return type of MyCLabs\Enum\Enum::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in 
phar:///shared/httpd/monitoring/vendor/dbrekelmans/bdi/bdi/vendor/myclabs/php-enum/src/Enum.php on line 246

2. Via manual download

I downloaded the chromedriver from here: https://sites.google.com/chromium.org/driver/ Made a "drivers" - directory in my project root

Then tried to get it via DIR and $projectDir - Both did not work:

$client = Client::createChromeClient(__DIR__.'/../../drivers/chromedriver');

Has someone an idea I could try to get panther to work? :)

agonyz commented 2 years ago

I'm also able to start the chromedriver via console like this:

./chromedriver

Still get this error when I try to use it with symfony panther:

unknown error: cannot find Chrome binary

agonyz commented 2 years ago

Got it working in my container via redownloading the google chrome browser. After that I made some adjustments to the Client:

$client = Client::createChromeClient(
            __DIR__.'/../../drivers/chromedriver',
            [
                '--no-sandbox',
                '--headless',
            ],
        );