geb with confirm不投掷方法的签名:geb.navigator.nonemptynavigator.getjs()?

发布于 2025-01-21 22:26:11 字数 1841 浏览 2 评论 0 原文

我创建了一个简单的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'
}

I have created a simple hello world app and here is the spec to test withconfirm block.

https://github.com/learningcscience/confirmgeb/blob/master/src/integration-test/groovy/booktest/BookSpec.groovy

It is throwing the error when i run the functional test.

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)

The line where the error is thrown is the withConfirm block. Why is it throwing this error? According to the docs

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.

and the example from the docs is

assert withConfirm(true) { $("input", name: "showConfirm").click() } == "Do you like Geb?"

http://www.gebish.org/manual/2.3/

I appreciate any help. Thanks!

If it is relevant i am using the following version chrome driver.

webdriverBinaries {
    chromedriver {
        version = '100.0.4896.20'
        architecture = 'X86'
    }
    geckodriver '0.24.0'
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

西瓜 2025-01-28 22:26:11

缺少的方法应指向JS-Object()。

您正在使用一些过时的版本。将一些依赖项更新为build.gradle中的一致级别后,测试将运行。

testCompile "org.seleniumhq.selenium:selenium-remote-driver:3.141.59"
testCompile "org.seleniumhq.selenium:selenium-api:3.141.59"
testCompile "org.seleniumhq.selenium:selenium-support:3.141.59"
testRuntime "org.seleniumhq.selenium:selenium-chrome-driver:3.141.59"
testRuntime "org.seleniumhq.selenium:selenium-firefox-driver:3.141.59"
testCompile 'org.gebish:geb-core:4.1'
testCompile 'org.gebish:geb-spock:4.1'

比您可以在规格(BooksPec)中添加主张:

withConfirm(true) {
    $("#btn").click()
}

顺便说一句。我们的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.

testCompile "org.seleniumhq.selenium:selenium-remote-driver:3.141.59"
testCompile "org.seleniumhq.selenium:selenium-api:3.141.59"
testCompile "org.seleniumhq.selenium:selenium-support:3.141.59"
testRuntime "org.seleniumhq.selenium:selenium-chrome-driver:3.141.59"
testRuntime "org.seleniumhq.selenium:selenium-firefox-driver:3.141.59"
testCompile 'org.gebish:geb-core:4.1'
testCompile 'org.gebish:geb-spock:4.1'

Than you can add a assertion to your spec (BookSpec):

withConfirm(true) {
    $("#btn").click()
}

Btw. our grailsw is outdated: https://grails.org/blog/2021-06-10-grails-wrapper-update.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文