selenium cakephp phpunit 有人让它工作吗?

selenium cakephp phpunit Has anyone got it to work?

我已经安装了 selenium 服务器,我已经 运行ning 了。我使用 composer 安装了 phpunit-selenium 和 facebook(selenium 插件)。

当我 运行 测试时,我得到同样的错误致命错误:Class XXdriverXX not found.

这发生在所有 类。

上网查了一下,关于cakephp中selenium的资料几乎没有。

我的问题很简单。有没有人得到 selenium 来与 cakephp 一起工作。如果有,你是怎么做到的?

我正在使用 wamp 和 cakephp3。

谢谢

enter code here
<?php

namespace App\Test\TestCase\Acceptance;

class UserSubscriptionTestFB extends PHPUnit_Framework_TestCase
{

    /**
     * @var RemoteWebDriver
     */
    protected $webDriver;

    public function setUp()
{
    $this->webDriver = RemoteWebDriver::create('http://localhost:4444/wd/hub', DesiredCapabilities::firefox());
}


public function tearDown()
{
    $this->webDriver->quit();
}

public function fillFormAndSubmit($inputs)
{
    $this->webDriver->get('http://vaprobash.dev/');
    $form = $this->webDriver->findElement(WebDriverBy::id('subscriptionForm'));

    foreach ($inputs as $input => $value) {
        $form->findElement(WebDriverBy::name($input))->sendKeys($value);
    }

    $form->submit();
}

public function testValidFormSubmission(array $inputs)
{
    $this->fillFormAndSubmit($inputs);

    $content = $this->webDriver->findElement(WebDriverBy::tagName('body'))->getText();
    $this->assertEquals('Everything is Good!', $content);
}

}

您似乎没有指定 Facebook 网络驱动程序的完整路径。

<?php

namespace App\Test\TestCase\Acceptance;

use \Facebook\WebDriver\Remote\DesiredCapabilities;
use \Facebook\WebDriver\Remote\RemoteWebDriver;
use \Facebook\WebDriver\WebDriverBy

class UserSubscriptionTestFB extends PHPUnit_Framework_TestCase
....