Net::ReadTimeout (Net::ReadTimeout) - Q: What am I missing? A: add read_timeout: capability!

My setup:

  • Windows 10 (x64)
  • Ruby 2.3.0 (x86) (lapis_lazuli 2.0.0, Watir 6.8.4 and selenium-webdriver 3.6.0)
  • Selenium-standalone-server 3.6.0
  • Appium desktop 1.2.4 (appium-sever 1.7.1)
  • LG Nexus 5 phone (running Android 6.0.1)

Via irb I can do this and it is slow, but works (the browser start and I can navigate to a url)

require 'lapis_lazuli' 
include LapisLazuli
url = "http://localhost:4444/wd/hub"
browser :chrome, {
	url: url, 
	browserName: "chrome",
	platformName: "Android",
	platformVersion: "6.0.1",
	deviceName: "Nexus5",
	appPackage: "",
    newCommandTimeout: "2000",
	javascript_enabled: true,
	unicodeKeyboard: true, 
	resetKeyboard: true
browser.goto ""

But when I just kickoff my test via cucumber
cucumber -f pretty BROWSER=appium DEVICE=disabled -t @mob

I get an error message:

  Background: Steps before the mobile account scenarios # features/mobile_account.feature:6
  Net::ReadTimeout (Net::ReadTimeout)
  ./features/support/env.rb:121:in `block in <top (required)>'

Is there anything I can do/set/configure to wait like 30 seconds longer before it does the timeout, or what are the steps I can take to properly debug this issue myself?


  • My ./features/support/env.rb:121 file is a copy of the part where I call for the browser in the irb example
  • What I did notice is that the chrome browser is started, only just after I get this timeout message in my command prompt
  • DEVICE=disabled I need to use since the lapis_lazuli gem has some setup where it sets the browser size and that is not possible on Android, so I point to a configuration that is empty (this worked before)
  • I’ve had this setup working before, just with lower selenium-standalone-server version and gem versions, but since it does work in irb there has to be something I can do/check to make it work again

At first I thought that adding the newCommandTimeout to the node configuration would solve the issue, but this is not the case. The real problem is as far as I’m able to see (still quiet new to appium) with cucumber has a timeout. and I already had the newCommandTimeout capability in there (which I mainly use when I play around using irb so the session does not timeout when I don’t enter a new command for a minute or so).
Then today I stumbled upon this thread!topic/watir-general/QXLypGALlGo
Which made me realize I read something about that on the Watir release notes (the lapis_lazuli gem is a wrapper around watir)
If I understand it correctly (I’ll do some more tests today), I need to add the timeout: capability to the browser.
timeout: 120,
I’ll let you all know if this is the solution or not.

After a bit more testing I noticed that timeout did not do anything either, so I kept on searching.
The weird part was that the test more ofter passed after setting this capability, but it might be that a reboot of my local machine or the device just made it x faster just like irb that just worked fine. So it took me some time to figure out this was not the solution either.

At some point I bumped into a post that mentioned the open_timeout and read_timeout capabilities.

And read_timeout solved the problem for me.
If I put it on 10, my test will fail after 10 seconds.
If I leave it out or put it on 60, my test will fail after 1 minute.
When I put it on 120 I can connect to my phones.just fine.

I hope this helps people that encounter the same issue I had.