Unable to start Symfony Panther

5.4k views Asked by At

I am trying to use Symfony Panther (Symfony 5.1, Windows 10, I have Chrome and Firefox) for the first time and the first line is already not working.

With the Github documentation (Basic Usage), here are my errors :

$client = \Symfony\Component\Panther\Client::createChromeClient();

// error : session not created: This version of ChromeDriver only supports Chrome version 80
// it's true, my Chrome version is 85. Eventually, I want to disable the sessions for it to work but I don't know how to do it.

Second attempt with Firefox :

$client = \Symfony\Component\Panther\Client::createFirefoxClient();

// Error : Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line

Third attempt with Firefox and binary :

$client = \Symfony\Component\Panther\Client::createFirefoxClient('C:\Program Files\Mozilla Firefox\firefox');

// my browser opens but nothing happens (blank page)
// PHP error : Could not start firefox (or it crashed) after 30 seconds.
2

There are 2 answers

0
Mmx On BEST ANSWER

You need to Update-upgrade Chrome client

  1. go to vendor/symfony/panther/chromedriver-bin There are 4 Chrome drivers (Win, Linux, Mac, Debian)
  2. In Linux just run update.sh and it update automatically
  3. In Windows -> follow and download latest Chrome driver (I have issue with name, check that NEW downloaded driver name is exactly chromedriver.exe otherwise not work, rewrite new 85 version chromedriver.exe over your 80 chromedriver.exe) https://sites.google.com/a/chromium.org/chromedriver/downloads
  4. Enjoy your scraping, crawling or just webpage testing.
2
Scotshield On

I went through the same situation, I decided by putting the driver's path in the function

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