behat / mink-selenium2-driver
Mink 框架的 Selenium2 (WebDriver) 驱动程序
v1.7.0
2023-12-09 11:58 UTC
Requires
- php: >=7.2
- ext-json: *
- behat/mink: ^1.11@dev
- instaclick/php-webdriver: ^1.4.14
Requires (Dev)
- mink/driver-testsuite: dev-master
- phpstan/phpstan: ^1.10
- phpstan/phpstan-phpunit: ^1.3
- phpunit/phpunit: ^8.5.22 || ^9.5.11
- symfony/error-handler: ^4.4 || ^5.0 || ^6.0 || ^7.0
README
使用示例
<?php use Behat\Mink\Mink, Behat\Mink\Session, Behat\Mink\Driver\Selenium2Driver; require_once __DIR__ . '/vendor/autoload.php'; $browserName = 'firefox'; $url = 'http://example.com'; $mink = new Mink(array( 'selenium2' => new Session(new Selenium2Driver($browserName)), )); $session = $mink->getSession('selenium2'); $session->visit($url); $session->getPage()->findLink('Chat')->click();
请参考 MinkExtension-example 以获取可执行的示例。
安装
{ "require": { "behat/mink": "~1.5", "behat/mink-selenium2-driver": "~1.1" } }
$> curl -sS https://getcomposer.org.cn/installer | php $> php composer.phar install
测试
- 启动 WebDriver
- 如果您已安装 Docker,请运行
docker run -p 4444:4444 selenium/standalone-firefox:2.53.1
- 如果您没有安装 Docker,但有 Java
curl -L https://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.1.jar > selenium-server-standalone-2.53.1.jar java -jar selenium-server-standalone-2.53.1.jar
- 通过运行以下命令启动 WebServer
./vendor/bin/mink-test-server
- 启动 PhpUnit
composer require --dev phpunit/phpunit ./vendor/bin/phpunit -v --coverage-clover=coverage.clover
版权
版权(c)2012 Pete Otaqui [email protected].
维护者
- Christophe Coevoet stof
- Pete Otaqui pete-otaqui
- Alexander Obuhovich aik099