1

I'm using selenium-webdriver to automate a CefSharp (CEF3) based application, but kept getting errors.

I use the following Ruby scripts to launch the CEF application:

require "selenium-webdriver"
cefpath = 'C:\mypathto\cefapp.exe'
Selenium::WebDriver::Chrome.path = cefpath
browser = Selenium::WebDriver.for :chrome
......

When running it, it does open the CEF application (a container of Chrome), but then gets stuck with the following error:

C:/Ruby200/lib/ruby/2.0.0/net/protocol.rb:158:in `rescue in rbuf_fill': Net::ReadTimeout (Net::ReadTimeout)
        from C:/Ruby200/lib/ruby/2.0.0/net/protocol.rb:152:in `rbuf_fill'
        from C:/Ruby200/lib/ruby/2.0.0/net/protocol.rb:134:in `readuntil'
        from C:/Ruby200/lib/ruby/2.0.0/net/protocol.rb:144:in `readline'
        from C:/Ruby200/lib/ruby/2.0.0/net/http/response.rb:39:in `read_status_line'
        from C:/Ruby200/lib/ruby/2.0.0/net/http/response.rb:28:in `read_new'
        from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:1406:in `block in transport_request'
        from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:1403:in `catch'
        from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:1403:in `transport_request'
        from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:1376:in `request'
        from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:1369:in `block in request'
        from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:852:in `start'
        from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:1367:in `request'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/remote/http/default.rb:83:in `response_for'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/remote/http/default.rb:39:in `request'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/remote/bridge.rb:634:in `raw_execute'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/remote/bridge.rb:99:in `create_session'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/remote/bridge.rb:68:in `initialize'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/chrome/bridge.rb:29:in `initialize'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/common/driver.rb:37:in `new'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/common/driver.rb:37:in `for'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver.rb:67:in `for'

Any idea why?

Thanks a lot.

4

1 回答 1

0

确保使用最新的 ChromiumDriver/Selenium 版本。根据这个:

https://code.google.com/p/chromiumembedded/wiki/UsingChromeDriver

CEF 与 ChromeDriver 2.14 版和 Selenium 2.44.0 一起工作得很好。

于 2015-02-13T20:34:17.803 回答