geb with confirm不投掷方法的签名:geb.navigator.nonemptynavigator.getjs()?
我创建了一个简单的Hello World应用程序,这是使用Conconfirm Block测试的规格。
当我运行功能测试时,它会丢弃错误。
No signature of method: geb.navigator.NonEmptyNavigator.getJs() is applicable for argument types: () values: []
Possible solutions: getX(), getY(), getX(), getY(), getAt(groovy.lang.EmptyRange), getAt(groovy.lang.Range)
groovy.lang.MissingMethodException: No signature of method: geb.navigator.NonEmptyNavigator.getJs() is applicable for argument types: () values: []
Possible solutions: getX(), getY(), getX(), getY(), getAt(groovy.lang.EmptyRange), getAt(groovy.lang.Range)
at geb.navigator.NonEmptyNavigator.methodMissing(NonEmptyNavigator.groovy:558)
at geb.content.PageContentSupport.methodMissing(PageContentSupport.groovy:35)
抛出错误的线是带有Confirm块的行。为什么要丢这个错误?根据文档
The first method, withConfirm() (and its ‘ok’ defaulted relative), is used to verify actions that will produce a confirm dialog. This method returns the confirmation message. The ok parameter controls whether the “OK” or “Cancel” button should be clicked.
和文档的示例是
assert withConfirm(true) { $("input", name: "showConfirm").click() } == "Do you like Geb?"
http://www.gebish.org/manual/ 2.3/
感谢任何帮助。谢谢!
如果是相关的,我正在使用以下版本的Chrome驱动程序。
webdriverBinaries {
chromedriver {
version = '100.0.4896.20'
architecture = 'X86'
}
geckodriver '0.24.0'
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
缺少的方法应指向JS-Object()。
您正在使用一些过时的版本。将一些依赖项更新为build.gradle中的一致级别后,测试将运行。
比您可以在规格(BooksPec)中添加主张:
顺便说一句。我们的Grailsw已过时:
The missing method should point to the js-object (https://www.gebish.org/manual/current/#js-object).
You are using some outdated versions. After Update some dependencies to a consistent level in the build.gradle, the tests will run.
Than you can add a assertion to your spec (BookSpec):
Btw. our grailsw is outdated: https://grails.org/blog/2021-06-10-grails-wrapper-update.html