![](/img/trans.png)
[英]Phpunit and Webdriver(Selenium2) - Can I run tests without selenium server like other languages?
[英]How can i get html headers with phpunit using Selenium2?
public function testheaders()
{
$url=$this->url('http://www.example.com/index.php');
$kur = get_headers($url);
var_dump($kur);
}
我收到error
: get_headers(): Filename cannot be empty
。
我的課程像其他所有測試一樣,擴展了PHPUnit_Extensions_Selenium2TestCase
。
get_headers()是一個PHP函數,它將為您提供HTTP請求返回到指定url的標頭。 您需要提供的參數是一個字符串,但是$ this-> url()返回一個PHPUnit_Selenium對象。
如果您想要該已知URL的標題,為什么不直接這樣做?
$kur = get_headers('http://www.example.com/index.php');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.