Appium 【ios 测试】新手入门,appium inspector 一直 loading+driver 起不来,知情人士请进

chuyaoyao · 2014年04月11日 · 最后由 daydayup 回复于 2014年04月11日 · 1747 次阅读

今天本来打算写第一个 case
可是对于新人来说总是困难重重
appium inspector 这个工具就是获取元素控件属性的工具 类似于 android 上的 uiautomatorviewer
前提要启动 appium server ,启动成功
然后运行你的 code 创建一个 session
之后点击 那个 “i” 按钮
问题出现了 inspector 一直在 loading
不知道是什么原因 感觉要 loading 到地老天荒了

require "rubygems"
require "selenium-webdriver"
capabilities = {
    :browserName => "ios",
    :platform => "MAC",
    :app => "com.baidu.news.newstest"
}
server_url = "http://0.0.0.0:4723/wd/hub"
@wd = Selenium::WebDriver.for(:remote, :desired_capabilities => capabilities, :url => server_url)
elements = @wb.find_elements(:tag_name, 'textField')
puts elements
@wb.quit

又已经了一番折腾
发现 build 出来的包,app 文件,在模拟器上能用 inspector 这个工具
但是换成真机的话 有报错了,估计 inspector 只能用在模拟器上
现在还剩一个问题:
真机上 为什么 driver 启动不起来??

共收到 12 条回复 时间 点赞

*** LOCAL GEMS ***

appium_lib (0.24.1)
awesome_print (1.2.0)
bigdecimal (1.2.0)
blankslate (2.1.2.4)
bundler (1.6.1)
bundler-unload (1.0.2)
childprocess (0.5.2)
executable-hooks (1.3.1)
ffi (1.9.3)
gem-wrappers (1.2.4)
io-console (0.4.2)
json (1.8.1, 1.7.7)
minitest (4.3.2)
multi_json (1.9.2)
parslet (1.5.0)
posix-spawn (0.3.8)
psych (2.0.0)
rake (0.9.6)
rdoc (4.0.0)
rubygems-bundler (1.4.3)
rubyzip (1.1.3)
rvm (1.11.3.9)
selenium-webdriver (2.41.0)
test-unit (2.0.0.0)
toml (0.1.1)
websocket (1.0.7)

问题更新一下
发现启动 driver 的时候就报错了
我用的是 ruby 请 ruby 高手来看一下
/Users/chuyaoyao/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/net/protocol.rb:158:in rescue in rbuf_fill': Net::ReadTimeout (Net::ReadTimeout)
from /Users/chuyaoyao/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/net/protocol.rb:152:in
rbuf_fill'
from /Users/chuyaoyao/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/net/protocol.rb:134:in readuntil'
from /Users/chuyaoyao/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/net/protocol.rb:144:in
readline'
from /Users/chuyaoyao/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/net/http/response.rb:39:in read_status_line'
from /Users/chuyaoyao/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/net/http/response.rb:28:in
read_new'
from /Users/chuyaoyao/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/net/http.rb:1406:in block in transport_request'
from /Users/chuyaoyao/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/net/http.rb:1403:in
catch'
from /Users/chuyaoyao/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/net/http.rb:1403:in transport_request'
from /Users/chuyaoyao/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/net/http.rb:1376:in
request'
from /Users/chuyaoyao/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/net/http.rb:1369:in block in request'
from /Users/chuyaoyao/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/net/http.rb:852:in
start'
from /Users/chuyaoyao/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/net/http.rb:1367:in request'
from /Users/chuyaoyao/.rvm/gems/ruby-2.0.0-p451/gems/selenium-webdriver-2.41.0/lib/selenium/webdriver/remote/http/default.rb:83:in
response_for'
from /Users/chuyaoyao/.rvm/gems/ruby-2.0.0-p451/gems/selenium-webdriver-2.41.0/lib/selenium/webdriver/remote/http/default.rb:39:in request'
from /Users/chuyaoyao/.rvm/gems/ruby-2.0.0-p451/gems/selenium-webdriver-2.41.0/lib/selenium/webdriver/remote/http/common.rb:40:in
call'
from /Users/chuyaoyao/.rvm/gems/ruby-2.0.0-p451/gems/selenium-webdriver-2.41.0/lib/selenium/webdriver/remote/bridge.rb:634:in raw_execute'
from /Users/chuyaoyao/.rvm/gems/ruby-2.0.0-p451/gems/selenium-webdriver-2.41.0/lib/selenium/webdriver/remote/bridge.rb:99:in
create_session'
from /Users/chuyaoyao/.rvm/gems/ruby-2.0.0-p451/gems/selenium-webdriver-2.41.0/lib/selenium/webdriver/remote/bridge.rb:68:in initialize'
from /Users/chuyaoyao/.rvm/gems/ruby-2.0.0-p451/gems/selenium-webdriver-2.41.0/lib/selenium/webdriver/common/driver.rb:33:in
new'
from /Users/chuyaoyao/.rvm/gems/ruby-2.0.0-p451/gems/selenium-webdriver-2.41.0/lib/selenium/webdriver/common/driver.rb:33:in for'
from /Users/chuyaoyao/.rvm/gems/ruby-2.0.0-p451/gems/selenium-webdriver-2.41.0/lib/selenium/webdriver.rb:67:in
for'
from build.rb:12:in `

'

再补充一下:包安装上了 ,也拉起来了,出错在发生在启动 driver 时

#3 楼 @chuyaoyao 从来没用过这个东西.好像 windows 和 mac 下的都不太好用, 不知道他是基于什么原来做的

我觉得 app 文件只能用在模拟器上 ipa 文件能用在真机上 恩 好像是这样的

所以。。。问题是 inspector 用不了?还是写好的测试代码运行不了。

#6 楼 @daydayup 写好的代码运行不了,启动 driver 时报错

#6 楼 @daydayup 代码就是上面的,包是 ipa 文件,真机 6.0 运行,表现是 ipa 包装上了,并且 lanch 起来了,但是代码在启动 driver 时报错,我用 ruby 写的,包错为超时,appium 没有报错信息。

@daydayup 改了之后任然超时错误 贴上 apium 的 log 看看能不能看出来什么?
info: App is an iOS bundle, will attempt to run as pre-existing

debug: Request received with params: {"desiredCapabilities":{"browserName":"iOS","platform":"Mac","version":"6.1","device":"iPhone Retina (4-inch)","app":"com.baidu.news.newstest"}}

info: Creating new appium session ae26adee-1e6f-475f-a1a7-807f9f43da0e
info: Removing any remaining instruments sockets
info: Cleaned up instruments socket /tmp/instruments_sock
info: Setting Xcode folder
info: Setting Xcode version

info: Setting iOS SDK Version

info: iOS SDK Version set to 7.1

info: Detecting automation tracetemplate

debug: Creating instruments

info: Not auto-detecting udid, running on sim
info: Localizable.strings is not currently supported when using real devices.
info: Not setting locale because we're using a real device
info: Not setting iOS and app preferences since we're on a real device
info: Starting iOS device log capture via idevicesyslog

info: Not setting device type since we're connected to a device

info: Installing ipa found at /Users/chuyaoyao/Desktop/newspages/baiduyuedu2.ipa
info: Creating iDevice object with udid 4a8e05203ae983e4c5f730a4b24ca02d72c6f814

debug: Nothing found on device, going ahead and installing.

debug: Starting instruments

info: Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments

info: [INSTSERVER] Instruments socket server started at /tmp/instruments_sock

info: Attempting to run app on real device with UDID 4a8e05203ae983e4c5f730a4b24ca02d72c6f814
info: Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -w 4a8e05203ae983e4c5f730a4b24ca02d72c6f814 com.baidu.news.newstest -e UIASCRIPT /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/uiauto/bootstrap.js -e UIARESULTSPATH /tmp/appium-instruments
info: And extra without-delay env: {}
info: And launch timeouts (in ms): {"global":90000}

debug: Appium request initiated at /wd/hub/status

info: Responding to client with success: {"status":0,"value":{"build":{"version":"0.18.0","revision":"17af02875e50682d6f1bdbd7885dad6e54e1c08a"}},"sessionId":"ae26adee-1e6f-475f-a1a7-807f9f43da0e"}

debug: Request received with params: {}

GET /wd/hub/status 200 1ms - 199b

重新梳理的该问题 请见http://testerhome.com/topics/701

同样的机器和环境版本, 有的被测应用能 loading 成功,有元素可查看到,,,但是有的应用,appium inspector 一直 loading,,,半天不出来,最好被测应用自己也自动退出,,唉

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册