简体   繁体   中英

EOFError: end of file reached Android Ruby Webdriver

I run the following with an Android emulator and it works, I try it with a real Android device (tested Samsung Galaxy S3 and HTC Wildfire) and I get EOFError: end of file reached

I am using Windows 7 Professional 64-bit

gem list 

shows

selenium-client (1.2.18)
selenium-webdriver (2.35.1, 2.34.0, 2.33.0, 2.31.0, 2.27.2)
watir (5.0.0 x86-mingw32, 4.0.2 x86-mingw32, 4.0.0 x86-mingw32)
watir-classic (4.0.1, 3.7.0, 3.5.0, 3.2.0)
watir-webdriver (0.6.4, 0.6.2)

amongst others.

I ran the following in both Emulator for Android 4.1.2, a real Samsung Galaxy S3 and a real HTC Wildfire S. The emulator worked and the other two failed in the same manner.

Command line:

>adb shell am start -a android.intent.action.MAIN -n org.openqa.selenium.android.app/.MainActivity

Starting: Intent { act=android.intent.action.MAIN cmp=org.openqa.selenium.android.app/.MainActivity }

>adb forward tcp:8090 tcp:8080

Then Ruby:

require 'selenium/client'
require 'watir-webdriver'
capabilities = Selenium::WebDriver::Remote::Capabilities.android
client = Selenium::WebDriver::Remote::Http::Default.new
driver = Selenium::WebDriver.for(:remote,:url=>'http://localhost:8090/wd/hub',:http_client=>client,:desired_capabilities=>capabilities)
driver.navigate.to('http://www.google.co.uk')
element = driver.find_element(:name, 'q')

Then with the real device it crashes with

EOFError: end of file reached
from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:141:in `read_nonblock'
from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:141:in `rbuf_fill'
from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2562:in `read_status_line'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2551:in `read_new'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1319:in `block in transport_request'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in `catch'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in `transport_request'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1293:in `request'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1286:in `block in request'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:745:in `start'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1284:in `request'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/http/default.rb:83:in `response_for'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/http/default.rb:39:in `request'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/bridge.rb:634:in `raw_execute'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/bridge.rb:612:in `execute'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/bridge.rb:580:in `find_element_by'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/common/search_context.rb:42:in `find_element'
from (irb):19
from C:/Ruby193/bin/irb:12:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'>> 

I've tried with real full tests that I have been running with a user agent and am trying to run on actual Android devices too, (which also passed in emulator and errored on real devices) but the above is the simplest example to show the error that I could find.

You didn't mention which version of android-server you were running.

When running the new version of android-server (android-server-2.32.0.apk) I was getting the EOF error on both emulator and real device, but at different points.

I solved the problem by using the previous version of android-server (android-server-2.21.0.apk). My tests are now running without error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM