Selenium(JAVA):用于输入字符串到Google搜索结果的输入错误

时间:2018-03-09 15:06:54

标签: java selenium

有人可以确认selenium 3.9是否支持通过
通过字符串  的SendKeys()?

测试场景如下:

代码段

    textBox.clear();
    System.out.println("cleared");
          textBox.sendKeys("Linux fast pc");
          System.out.println("sent search string in google");`

错误

    Exception in thread "main" org.openqa.selenium.WebDriverException: 
        unknown error: call function result missing 'value'
          (Session info: chrome=65.0.3325.146)
          (Driver info: chromedriver=2.33.506120 
        (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 10.0.16299 x86) 
        (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
        Build info: version: '3.9.1', revision: '63f7b50', time: '2018-02-07T22:42:22.379Z'
        System info: host: 'ADMIN-PC', ip: '192.168.1.5', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_161'
        Driver info: org.openqa.selenium.chrome.ChromeDriver
        Capabilities {acceptSslCerts: true, applicationCacheEnabled: false, 
        browserConnectionEnabled: false, browserName: chrome, chrome: 
        {chromedriverVersion: 2.33.506120 (e3e53437346286..., userDataDir: 
        C:\Users\admin\AppData\Loca...}, cssSelectorsEnabled: true, 
        databaseEnabled: false, handlesAlerts: true, hasTouchScreen: false, 
        javascriptEnabled: true, locationContextEnabled: true, 
        mobileEmulationEnabled: false, nativeEvents: true, 
        networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, 
        platformName: XP, rotatable: false, setWindowRect: true, 
        takesHeapSnapshot: true, takesScreenshot: true, 
        unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 
        65.0.3325.146, webStorageEnabled: true}
        Session ID: 612795efdb79a090f0e9c916e2ef059d
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
            at java.lang.reflect.Constructor.newInstance(Unknown Source)`

如果您需要更多详细信息,请写信给我。

此致 Sudeept

1 个答案:

答案 0 :(得分:0)

您必须使用最新版本的ChromeDriver。 从此处下载最新的ChromeDriver: https://chromedriver.storage.googleapis.com/index.html?path=2.41/

您的问题将得到解决。