给 withFrame - "call function result missing 'value'"

Geb withFrame - "call function result missing 'value'"

我是 Geb 中使用 withFrames 的新手,我正在尝试遵循 Geb 书中的示例。

我正在尝试让我的代码在框架内输入文本并按下按钮。

首选方法是在包含页面内定义框架元素,但现在我只想看看我在 withFrame 调用中做错了什么。

        def "Write and Post a Small Comment" () {
        when:
            MyBlogSpot bs = to MyBlogSpot
        then:
            bs.readMoreLink.click()

            withFrame("comment-editor"){     // <---- this is the line 16 in the error statement
                $('#commentBodyField') << "my text"
                $("button", name:"postCommentSubmit").click()
            }

    }

以上为规格书

我要达到的元素是:

<iframe allowtransparency="true" class="blogger- iframe-colorize blogger-comment-from-post" frameborder="0" height="194px" id="comment-editor" name="comment-editor" src="https://www.blogger.com/comment-iframe.g?blogID=3577645066754224503&amp;postID=6815587395142211832&amp;blogspotRpcToken=2994523#%7B%22color%22%3A%22rgb(34%2C%2034%2C%2034)%22%2C%22backgroundColor%22%3A%22rgb(255%2C%20255%2C%20255)%22%2C%22unvisitedLinkColor%22%3A%22rgb(204%2C%20102%2C%2017)%22%2C%22fontFamily%22%3A%22Arial%2C%20Tahoma%2C%20Helvetica%2C%20FreeSans%2C%20sans-serif%22%7D" width="100%" data-resized="true"></iframe>

无论我为 withFrame 使用什么参数 - 即使我在检查浏览器调试器工具后使用 withFrame(2) - 我在 运行 测试时得到的错误是:

at CommentSpec.Write and Post a Small 
Comment(CommentSpec.groovy:17)
    Caused by:
    org.openqa.selenium.WebDriverException: unknown error: call function result missing 'value'
      (Session info: chrome=70.0.3538.77)
      (Driver info: chromedriver=2.32.498550 (9dec58e66c31bcc53a9ce3c7226f0c1c5810906a),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 0 milliseconds
    Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
    System info: host: 'GUY-HP', ip: '192.168.1.2', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_161'
    Driver info: org.openqa.selenium.chrome.ChromeDriver
    Capabilities [{mobileEmulationEnabled=false, hasTouchScreen=false, platform=XP, acceptSslCerts=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, platformName=XP, setWindowRect=true, unexpectedAlertBehaviour=, applicationCacheEnabled=false, rotatable=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.32.498550 (9dec58e66c31bcc53a9ce3c7226f0c1c5810906a), userDataDir=C:\Users\Guy\AppData\Local\Temp\scoped_dir12868_17851}, takesHeapSnapshot=true, pageLoadStrategy=normal, unhandledPromptBehavior=, databaseEnabled=false, handlesAlerts=true, version=70.0.3538.77, browserConnectionEnabled=false, nativeEvents=true, locationContextEnabled=true, cssSelectorsEnabled=true}]
    Session ID: da4a617e55935af5a32b5c7c17213231
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
        at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
        at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:82)
        at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:45)
        at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:586)
        at org.openqa.selenium.remote.RemoteWebDriver$RemoteTargetLocator.frame(RemoteWebDriver.java:912)
        at geb.frame.DefaultFrameSupport.executeWithFrame(DefaultFrameSupport.groovy:57)
        at geb.frame.DefaultFrameSupport.withFrame(DefaultFrameSupport.groovy:36)
        at geb.Page.withFrame(Page.groovy:120)
        at geb.Browser.methodMissing(Browser.groovy:217)
        at geb.spock.GebSpec.methodMissing(GebSpec.groovy:60)
        ... 1 more 

如果我需要粘贴任何其他代码,请告诉我。 TIA!

这看起来像是二进制文件之间的版本兼容性问题。

错误表明您正在使用

chrome=70.0.3538.77
Driver info: chromedriver=2.32.498550

您想下载适用于您的 Chrome 版本的最新 chromedriver 2.43。请参阅此处了解兼容版本:Chrome Drivers