3

我用 Android 模拟器运行以下命令,它可以工作,我用真正的 Android 设备(测试三星 Galaxy S3 和 HTC Wildfire)尝试它,我得到 EOFError: end of file reached

我正在使用 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

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

>adb 转发 tcp:8090 tcp:8080

然后红宝石:

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 设备上运行(它也通过了模拟器并在真实设备上出错)但上面是显示的最简单的示例我能找到的错误。

4

1 回答 1

1

你没有提到你运行的是哪个版本的 android-server 。

在运行新版本的 android-server (android-server-2.32.0.apk) 时,我在模拟器和真实设备上都遇到了 EOF 错误,但在不同的点。

我通过使用以前版本的 android-server (android-server-2.21.0.apk) 解决了这个问题。我的测试现在运行没有错误。

于 2013-12-09T16:47:32.727 回答