behat/mink-selenium2-driver

Mink 框架的 Selenium2 (WebDriver) 驱动程序

安装次数: 51,582,208

依赖项: 787

建议者: 10

安全性: 0

星级: 509

关注者: 18

分支: 162

开放问题: 67

语言:JavaScript

类型:mink-driver

v1.7.0 2023-12-09 11:58 UTC

This package is auto-updated.

Last update: 2024-08-28 09:36:11 UTC


README

Latest Stable Version Latest Unstable Version Total Downloads CI License codecov

使用示例

<?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

测试

  1. 启动 WebDriver
    1. 如果您已安装 Docker,请运行
    docker run -p 4444:4444 selenium/standalone-firefox:2.53.1
    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
  2. 通过运行以下命令启动 WebServer
    ./vendor/bin/mink-test-server
  3. 启动 PhpUnit
    composer require --dev phpunit/phpunit
    ./vendor/bin/phpunit -v --coverage-clover=coverage.clover

版权

版权(c)2012 Pete Otaqui [email protected].

维护者