Selenium错误:Selenium Server在端口4444上的主机localhost上未处于活动状态

时间:2014-07-04 13:59:27

标签: testing selenium phpunit

使用(安装了phpunit和selenium)测试以下对象:

 <?php

class TestLogin extends PHPUnit_Extensions_Selenium2TestCase{

public function setUp()
{
    $this->setHost('localhost');
    $this->setPort(4444);
    $this->setBrowser('firefox');
    $this->setBrowserUrl('http://debian-vm/phpUnitTutorial');
}


public function testHasLoginForm()
{
    $this->url('');

    $email = $this->byName('email');
    $password = $this->byName('password');

    $this->assertEquals('', $email->value());
    $this->assertEquals('', $password->value());
}
}

这会引发以下错误:

Time: 9 ms, Memory: 6.75Mb

There was 1 skipped test:

1) testLogin::testHasLoginForm
The Selenium Server is not active on host localhost at port 4444.

OK, but incomplete, skipped, or risky tests!
Tests: 1, Assertions: 0, Skipped: 1.

有没有办法解决这个问题?我通过youtube跟踪了一个教程https://www.youtube.com/watch?v=zva_GETXimI#t=12而且我几乎在开始时陷入困境。

1 个答案:

答案 0 :(得分:2)

检查selenium服务器是否在主机中运行。