您好,登錄后才能下訂單哦!
在用GEB做自動化測試時,跳轉到一個新頁面往往會用at語法,例如在一個SchoolAddPage.groovy里:
class SchoolAddPage extends Page{
static at = {
$('.box-title').text() == "添加英語天地"
}
}
運行程序時往往會出現如下的錯誤信息,詳細如下。這時別懷疑你是不是選錯了對象或者判斷出錯,也有可能是程序運行太快。可以修改成:
static at = {
waitFor() { $('.box-title').text() == "添加英語天地" }
}
也許就能解決問題
geb.error.UnexpectedPageException: At checker page verification failed for page page.SchoolAddPage
at geb.navigator.NonEmptyNavigator.click(NonEmptyNavigator.groovy:492)
at geb.navigator.NonEmptyNavigator.click(NonEmptyNavigator.groovy:469)
at geb.content.TemplateDerivedPageContent.click(TemplateDerivedPageContent.groovy:71)
SchoolManageSpec.to add a school page(SchoolManageSpec.groovy:59)
Caused by: Assertion failed:
$('.box-title').text() == "添加英語天地"
| | |
[] null false
at page.SchoolAddPage._clinit__closure2(SchoolAddPage.groovy:8)
at cn.com.nd.school.page.SchoolAddPage._clinit__closure2(SchoolAddPage.groovy)
at geb.Page.verifyThisPageAtOnly(Page.groovy:228)
at geb.Page.verifyAt(Page.groovy:182)
at geb.Browser.methodMissing(Browser.groovy:206)
at geb.navigator.NonEmptyNavigator.click(NonEmptyNavigator.groovy:481)
... 3 more
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。