您好,登录后才能下订单哦!
在用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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。