4

Started to receive when trying to reach any host:

[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'

Prerequisites: - Only real devices, no error on iOS Simulator - Latest versions of iPhoneDriver / Selenium Webdriver, iOS5 / iOS6 - Tried on several units (Mac OS) and get the same problem - Used to work well even a few days ago - have no idea what could happen - Does not reproduce on Andoid on similar code

Sled
  • 18,541
  • 27
  • 119
  • 168

1 Answers1

0

This usually happens when there is some kind of network connectivity problems. Is is possible that your iphone is running too slowly to cope with the selenium script. So increase the timeout.

try this

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
Amey
  • 8,470
  • 9
  • 44
  • 63
  • thanks for the answer. but it didn't help :( still receive the same error. i also tried adding: http = Net::HTTP.new(@host, @port) http.read_timeout = 500 (from [this answer](http://stackoverflow.com/questions/10011387)) before my actions and it didn't help either. I think I've reached a dead end in this question - tried on different WiFi's, different devices (iPhones and iPads). What is also interesting - after i execute 'driver.get' the page starts to load, but does not load fully - then the error is thrown and iWebDriver hangs. Can't believe i'm the only one with this issue. – futurecraft Dec 13 '12 at 10:30
  • have u tried directly connecting the iphone to the machine you are running your script from? – Amey Dec 13 '12 at 14:53
  • yes, probably i tried all possible combinations :) still no solution. – futurecraft Dec 13 '12 at 17:01
  • i think the problem is in this iWebDriver (iPhoneDriver) - for some reason it hangs and stops responding, so Ruby code acts correctly. I used some old revision of iWebDriver when this error started to appear - so I updated it to the latest version. but this didn't solve the issue. – futurecraft Dec 13 '12 at 17:09
  • which IPhone are you on? 3g 4 4s or 5? Whats the memory on it like? – Amey Dec 13 '12 at 17:15
  • iphone 4, (iOS 5.1.1); iphone 4S (6.0); ipad 1 (not sure about iOS version) and ipad 3 (iOS 6.x). I will retry on a 'clean' memory - after closing all apps and stuff, but i don't think that it is a source of this problem. It used to work fine always and i didn't ever had to prepare the device by closing everything. – futurecraft Dec 14 '12 at 08:54