【发布时间】:2014-06-17 00:12:14
【问题描述】:
我想要一些关于在多个浏览器上使用 selenium2 运行 phpunit 测试的帮助。我有以下 phpunit 测试,它在 Firefox 浏览器上运行良好。如何针对 Chrome、IE、Opera、Safari 等其他工具运行它?
如果你能提供帮助,我已经添加了下面的测试用例。任何指向帮助网站的链接都将不胜感激。
class exampleTestcase2 extends PHPUnit_Extensions_Selenium2TestCase {
public function setUp()
{
$this->setHost('localhost'); // Set the hostname for the connection to the Selenium server.
$this->setPort(4444); // set port # for connection to selenium server
$this->setBrowser('firefox'); // set the browser to be usedRequest State Change
$this->setBrowserUrl('http://www.php.net/'); // set base URL for tests
}
public function testCMS() // Test the title on index page
{
$this->currentWindow()->maximize(); // open window in full screen
$this->url('index.php'); // Set the URL to access the login page
$this->assertEquals('PHP: Hypertext Preprocessor', $this->title());
}
}
【问题讨论】:
标签: selenium-webdriver phpunit