【问题标题】:Selenium (JAVA):Input to enter a string into Google Search results into errorSelenium (JAVA):将字符串输入到 Google 搜索结果中的输入错误
【发布时间】:2018-08-18 04:40:31
【问题描述】:

有人可以确认 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)`

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

问候, 苏迪特

【问题讨论】:

  • 请更改为 chrome 64 并确保您拥有正确版本的 chromedriver
  • 我怀疑您是否能够在sendKeys() 之前到达textBox.clear();,因为驱动程序信息:org.openqa.selenium.chrome.ChromeDriver
  • @Vinay,chrome 65 与 2.33.506120 版本的 chromdriver 一起使用 - 两者都是最新的
  • @Debanjan - 这个代码块前面的语句是 - if (textBox.isEnabled()) System.out.println("search box enabled");正在成功打印,紧随此命令之后是 textBox.click(); System.out.println("点击");正在打印,所以我认为我们可以假设它执行得很好

标签: java selenium


【解决方案1】:

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

你的问题就解决了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-11-17
    • 1970-01-01
    • 2020-12-28
    • 2018-10-13
    • 2016-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多