2017-02-20 30 views
0

unexpexted页我GebConfig.groovy注册的页面意想不到象下面这样:盖布:如何注册

unexpectedPages = [EmptySearchResultPage] 

和页面类是象下面这样:

import geb.Page 

class EmptySearchResultPage extends Page{ 
    static at = { 
//  errorTitle.displayed 
     $("h1",text:contains('Sorry… We Found No XXX.')) 
     } 
    static content = { 
     errorTitle(wait:true,required:false) { $("h1",text:contains('Sorry… We Found No XXX.')) } 
    } 
} 

但我得到以下例外:

geb.error.InvalidGebConfiguration: Unexpected pages configuration has to be a collection of classes that extend geb.Page but found "[[:]]". Did you forget to include some imports in your config file? 
    at geb.Configuration.getUnexpectedPages(Configuration.groovy:189) 
    at geb.Browser.doCheckIfAtAnUnexpectedPage(Browser.groovy:416) 
    at geb.Browser.checkIfAtAnUnexpectedPage(Browser.groovy:402) 
    at geb.Page.verifyAt(Page.groovy:181) 
    at geb.Browser.doAt(Browser.groovy:454) 
    at geb.Browser.at(Browser.groovy:353) 
    at geb.Browser.to(Browser.groovy:568) 
    at geb.Browser.to(Browser.groovy:556) 
    at geb.Browser.to(Browser.groovy:523) 
    at geb.spock.GebSpec.methodMissing(GebSpec.groovy:56) 
    at com.skygate.global.HomePageTest.Open Homepage(HomePageTest.groovy:59) 

我犯了什么错误? 请帮忙。谢谢。

回答

1

错误消息说它:

Did you forget to include some imports in your config file? 

因此,假设你的网页是不是在默认包(JVM不喜欢的!),你需要将其导入到GebConfig。