尝试访问任何主机时开始接收:
[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 上重现类似代码
最佳答案
这通常发生在存在某种网络连接问题时。有可能是你的 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
关于ios - 导航到主机时“在 rbuf_fill 中救援”[iPhoneDriver + Selenium Webdriver + Ruby],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13844931/