我使用Android模拟器运行以下内容并且它可以正常运行,我尝试使用真正的Android设备(经过测试的三星Galaxy S3和HTC Wildfire),我得到了 EOFError:文件结束
我正在使用Windows 7 Professional 64位
gem list
显示
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)
等。
我在Android 4.1.2的模拟器,真正的三星Galaxy S3和真正的HTC Wildfire S中运行了以下内容。模拟器工作,其他两个以同样的方式失败。
命令行:
> adb shell am start -a android.intent.action.MAIN -n org.openqa.selenium.android.app/.MainActivity
开始:意图{act = android.intent.action.MAIN cmp = org.openqa.selenium.android.app / .MainActivity}
> adb forward tcp:8090 tcp:8080
然后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')
然后使用真实设备它会崩溃
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>'>>
我尝试了一直使用用户代理运行的真正的完整测试,并尝试在实际的Android设备上运行(也通过模拟器传递并在真实设备上出错),但上面是最简单的示例显示我能找到的错误。
答案 0 :(得分:1)
你没有提到你正在运行的android-server版本。
当运行新版本的android-server(android-server-2.32.0.apk)时,我在模拟器和真实设备上都出现了EOF错误,但是在不同的点上。
我通过使用以前版本的android-server(android-server-2.21.0.apk)解决了这个问题。我的测试现在正在运行而没有错误。