1

我的设置是这样的:

  1. 最新的 Selenium 服务器
  2. 最新的 Phpunit 和 Selenium 插件
  3. Firefox 3.6(即使没有 Selenium IDE 也没有安装插件)

好的,最后我的代码是这样的:

<?php
class TestLogin extends PHPUnit_Extensions_Selenium2TestCase
{
    public function setUp()
    {
        $this->setHost('localhost');
        $this->setPort(4444);
        $this->setBrowser('firefox');
        $this->setBrowserUrl('http://localhost');
        $this->prepareSession();
        $this->url('http://localhost');
    }

    public function testSignupFormFor()
    {
         $this->url('http://localhost/ci/index.php/signup/signupController/signup');

         $div = $this->byCssSelector('div#signupFormId');
         $form =$this->byCssSelector('div#signupFormId>form');
         $userObj = $this->byName("userName");

         $userName = $userObj->value('root');   -----> Server hangs here

         $this->assertEquals('root',$userName);
?>

当我使用 phpunit filename.php 运行代码时,它会打开 firefox 并挂起消息

当我看到服务器的日志是这样的

16:55:36.608 INFO - Executing: [send keys: 2 org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebEleme
nt@8e7c2cfc, [r, o, o, t]] at URL: /session/b0da54ee-6029-4ff6-b0b7-2d9b44cbb81c/element/2/value)
16:56:36.631 INFO - Executing: [delete session: b0da54ee-6029-4ff6-b0b7-2d9b44cbb81c] at URL: /session/b0da54ee-6029-4ff
6-b0b7-2d9b44cbb81c)

有人可以帮帮我吗?

4

0 回答 0