このチュートリアルhttp://net.tutsplus.com/tutorials/php/how-to-use-selenium-2-with-phpunit/を使用してテストを作成しました。すべて正常に動作しますが、このテストは Firefox でのみ起動できます。インターネットでこれに関する多くの記事を読みましたが、解決策が見つかりません。Sebastian Bergmann による Windows XP、PHP 5.4.7、PHPUnit 3.7.13 があります。テストを実行する前に、selenium-server-standalone-2.28.0.jar を起動しました。私のテストがあります
<?php
class Example extends PHPUnit_Extensions_Selenium2TestCase
{ protected function setUp()
{
$this->setBrowser("firefox");
$this->setBrowserUrl('http://test.com/');
}
public function testogin()
{
$this->url('http://test.com/');
$this->timeouts()->implicitWait(10000);
$username = $this->byId('user_login');
$username->value('test.ru');
$password = $this->byId('user_pass');
$password->value('test');
$this->byId('login_btn')->click();
}
}
?>
他のブラウザーでこのテストを実行するのを手伝ってください。さらに情報が必要な場合は、私に尋ねてください。ありがとう