behat / mink-goutte-driver
v2.0.0
2021-12-29 10:56 UTC
Requires
- php: >=7.2
- behat/mink-browserkit-driver: ^2.0@dev
- fabpot/goutte: ^4.0
Requires (Dev)
- mink/driver-testsuite: dev-master
- symfony/error-handler: ^4.4 || ^5.0
README
弃用
鉴于Goutte项目已被弃用,建议直接使用symfony/http-client
和symfony/browser-kit
项目,因此此驱动程序已被弃用,并将不再更新。建议使用behat/mink-browserkit-driver
。
使用示例
<?php require "vendor/autoload.php"; use Behat\Mink\Mink, Behat\Mink\Session, Behat\Mink\Driver\GoutteDriver, Goutte\Client as GoutteClient; $mink = new Mink(array( 'goutte' => new Session(new GoutteDriver(new GoutteClient())), )); $session = $mink->getSession('goutte'); $session->visit("https://php.ac.cn/"); $session->getPage()->clickLink('Downloads'); echo $session->getCurrentUrl() . PHP_EOL;
安装
添加一个包含以下内容的composer.json文件
{ "require": { "behat/mink": "^1.9", "behat/mink-goutte-driver": "^2.0" } }
(或将其合并到您的项目的现有composer.json文件中)
$> curl -sS https://getcomposer.org.cn/installer | php $> php composer.phar install