2016-05-16 104 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