behat / mink-zombie-driver
Mink框架的Zombie.js驱动程序
v1.6.0
2022-03-28 14:41 UTC
Requires
- php: >=7.2
- ext-json: *
- ext-sockets: *
- behat/mink: ~1.9@dev
- symfony/process: ^4.4 || ^5.0 || ^6.0
Requires (Dev)
- mink/driver-testsuite: dev-master
- phpunit/phpunit: ^8.5.22 || ^9.5.11
- symfony/error-handler: ^4.4.36 || ^5.4.2 || ^6.0.2
README
安装与兼容性
您需要一个正常工作的NodeJS和npm安装。通过npm安装zombie.js库。
$ npm install -g zombie
驱动程序需要zombie.js版本2.0.0或更高版本。
使用Composer安装所有必要的PHP依赖项。
$ composer require --dev behat/mink behat/mink-zombie-driver
用法示例
<?php use Behat\Mink\Mink, Behat\Mink\Session, Behat\Mink\Driver\ZombieDriver, Behat\Mink\Driver\NodeJS\Server\ZombieServer; $host = '127.0.0.1'; $port = '8124'; $nodeBinary = '/usr/local/bin/node'; $mink = new Mink(array( 'zombie' => new Session(new ZombieDriver(new ZombieServer( $host, $port, $nodeBinary ))), )); $mink->setDefaultSessionName('zombie'); $session = $mink->getSession(); $session->visit('http://example.org'); $page = $session->getPage(); $elem = $page->find('css', 'h1'); echo $elem->getText();
版权
版权(c)2011-2012 Pascal Cremer [email protected]
维护者
- Alexander Obuhovich aik099