【发布时间】:2011-03-22 12:42:51
【问题描述】:
我有一个针对远程 Selenium 服务器实例运行的简单 Selenium 测试。
我正在尝试测试页面性能,有些页面可能会超过最大执行时间,我正在努力解决这个问题。
无论我在 setTimeout() 中放入什么,它总是等待整个页面加载或服务器超时。
public static $browsers = array(
array(
'name' => 'Firefox on Ubuntu',
'browser' => '*firefox',
'host' => 'dev-ubuntudesktop',
'port' => 4444,
'timeout' => '1000',
),
)
public function testSlowPage() {
$this->setTimeout(1000);
$this->open('myslowaddress');
$this->assertTextNotPresent('Internal Server Error');
}
尽管我不使用openAndWait,但在页面加载或网络服务器终止请求之前,上述示例不会到达断言行。
我真正想要的是确认“页面在 1 秒内加载”的测试,无需等待 30 秒(或任何 PHP 超时设置)。
【问题讨论】: