2016-05-16 96 views

回答

1

您可以通過方法直接打開網址:amOnPage

PHP-Browser

如果您使用的硒,你可以在這裏看到:WebDriver

+0

它不適合我反正請檢查我的codeception配置文件和驗收測試代碼文件。 配置:http://pastebin.com/hk0iJ1ib 代碼:http://pastebin.com/hHguqFKT –

+0

我認爲,你的配置有問題。嘗試使用此配置:http://pastebin.com/naaF6Ekx –

+0

感謝您的幫助,它的工作原理,無論如何有一個很好的例子this.http://code.tutsplus.com/tutorials/acceptance-testing-with -codeception - 網36337 –

1

你應該在你的配置已經啓用的webdriver的套件您正在使用。通常使用PhantomJS或Selenium進行驗收測試。您還應該設置一個基本網址。即:

class_name: AcceptanceTester 
modules: 
    enabled: 
     - WebDriver: 
      url: 'http://localhost/' 
      browser: phantomjs 

有兩個命令:

amOnPage($頁) - 追加$頁面,URL和打開

amOnUrl($ URL) - 打開$ URL直接

所以與上面的配置:

$I->amOnPage("works"); //opens http://localhost/works 
$I->amOnPage("http://localhost/dontwork"); //error! 
$I->amOnUrl("http://localhost/works"); //opens http://localhost/works