我已经使用这个安装了它:
composer require --dev dbrekelmans/bdi && vendor/bin/bdi detect drivers
我尝试过这个:
composer require dbrekelmans/bdi && vendor/bin/bdi detect drivers
我也尝试过这样安装:
sudo snap install chromium --devmode
Panther 总是抱怨找不到驱动程序,但它确实已安装:
at vendor/symfony/panther/src/ProcessManager/ChromeManager.php:92
88▕ if ($binary = (new ExecutableFinder())->find('chromedriver', null, ['./drivers', './vendor/bin'])) {
89▕ return $binary;
90▕ }
91▕
➜ 92▕ throw new \RuntimeException('"chromedriver" binary not found. Install it using the package manager of your operating system or by running "composer require --dev dbrekelmans/bdi && vendor/bin/bdi detect drivers".');
93▕ }
94▕
95▕ private function getDefaultArguments(): array
96▕ {
当我跑步时
vendor/bin/bdi detect drivers
我得到这个:
[OK] chromedriver 123.0.6312.122 installed to drivers/chromedriver
为什么 Panther 无法检测或使用 Chrome 驱动程序?
在 Ubuntu 上使用 PHP 8.2 运行它。我没有使用 Docker 映像。
在这里找到了解决方案: https://skolo.online/documents/webscrapping/
但是从这里安装了最新版本: https://googlechromelabs.github.io/chrome-for-testing/
首先安装Chrome:
sudo apt update
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install wget
sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo apt-get install -f
google-chrome --version
然后安装Chrome驱动程序:
wget https://storage.googleapis.com/chrome-for-testing-public/123.0.6312.122/linux64/chromedriver-linux64.zip
unzip chromedriver-linux64.zip
sudo mv chromedriver /usr/bin/chromedriver
sudo chown root:root /usr/bin/chromedriver
sudo chmod +x /usr/bin/chromedriver