2013-06-23 29 views
0

我無法找到PHPunit的例子。我不知道我想用什麼功能。有很多java的例子,但我無法找到任何PHPUnit。 我打開了http://localhost:4444/wd/hub/static/resource/hub.html ,並且功能中沒有代理設置。 當我使用函數setDesiredCapabilities時,硒總是打開IE。下面是我的「代碼」如何使用phpunit和selenium2設置代理?

class testtest extends PHPUnit_Extensions_Selenium2TestCase { 



protected function setUp() 
{ 

    $capabilities=array('browser' => 'firefox'); 
    $this->setDesiredCapabilities($capabilities); 
    $this->setBrowserUrl('http://www.test.com/'); 

} 

public function testvvatg() 
{ 
    $this->url('http://www.test.com'); 
    $url=$this->title(); 
    $this->assertEquals('asdf', $url); 
} 
} 

請幫助謝謝

回答

1

雖然這個話題的時候,我發現它,而谷歌搜索爲解決這個問題,所以我想我會做出貢獻。

讀取PHPUnit Selenium2TestCase的源代碼,可以看到a link to the format that setDesiredCapabilities requires。特別是,你想要Proxy JSON Object format

例如:

$this->setDesiredCapabilities(array(
    "proxy" => array(
     "proxyType" => "manual", 
     "httpProxy" => "proxyhost.com:1337", 
     "noProxy" => "dontproxy.me/please" //This one is undocumented. I'm not sure how to specify more than one 
    ) 
)); 
相關問題