简体   繁体   中英

Unable to start Symfony Panther

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.

我遇到了同样的情况,我决定将驱动程序的路径放在函数中

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM