【问题标题】:'rescue in rbuf_fill' when navigating to host [iPhoneDriver + Selenium Webdriver + Ruby]导航到主机 [iPhoneDriver + Selenium Webdriver + Ruby] 时“在 rbuf_fill 中救援”
【发布时间】:2012-11-30 11:05:56
【问题描述】:

尝试到达任何主机时开始接收:

[1] pry(main)> require "selenium-webdriver"
=> true
[2] pry(main)> driver = Selenium::WebDriver.for :remote, :url => "http://xxx.xxx.xxx.xxx:3001/wd/hub/", :desired_capabilities => :iphone
=> #<Selenium::WebDriver::Driver:0x..fb1a8bc1a0f688d1c browser=:iPhone>
[3] pry(main)> driver.get "http://google.com"
Timeout::Error: Timeout::Error
from /Users/apple/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill'

先决条件: - 只有真机,iOS 模拟器没有错误 - 最新版本的 iPhoneDriver / Selenium Webdriver, iOS5 / iOS6 - 尝试了几个单元(Mac OS)并得到同样的问题 - 几天前还可以正常工作 - 不知道会发生什么 - 在类似代码上不会在 Andoid 上重现

【问题讨论】:

  • 这些是错误消息...代码在哪里?
  • 感谢您的回答,但请仔细查看 - 那里的代码。

标签: ios ruby selenium webdriver


【解决方案1】:

这通常发生在出现某种网络连接问题时。您的 iphone 运行速度可能太慢而无法处理 selenium 脚本。 所以增加超时时间。

试试这个

client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 180 # Increase the time if it takes longer to connect to the remote device 
driver = Selenium::WebDriver.for :remote, :url => "http://xxx.xxx.xxx.xxx:3001/wd/hub/", :desired_capabilities => :iphone, :http_client => client

【讨论】:

  • 感谢您的回答。但它没有帮助:(仍然收到相同的错误。我还尝试在我的操作之前添加:http = Net::HTTP.new(@host, @port) http.read_timeout = 500 (from this answer)也没有帮助。我想我在这个问题上已经走到了死胡同 - 在不同的 WiFi、不同的设备(iPhone 和 iPad)上尝试过。还有什么有趣的 - 在我执行“driver.get”之后,页面开始加载, 但没有完全加载 - 然后引发错误并且 iWebDriver 挂起。不敢相信我是唯一遇到此问题的人。
  • 您是否尝试过将 iphone 直接连接到您正在运行脚本的机器?
  • 是的,可能我尝试了所有可能的组合:) 仍然没有解决方案。
  • 我认为问题出在这个 iWebDriver (iPhoneDriver) - 由于某种原因它挂起并停止响应,因此 Ruby 代码可以正确运行。当此错误开始出现时,我使用了 iWebDriver 的一些旧版本 - 所以我将其更新到最新版本。但这并没有解决问题。
  • 您使用的是哪部 iPhone? 3g 4 4s 还是 5?它上面的记忆是什么样的?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-11-26
  • 1970-01-01
  • 2012-02-26
相关资源
最近更新 更多