`
MyEyeOfJava
  • 浏览: 1131673 次
  • 性别: Icon_minigender_1
  • 来自: 北京
博客专栏
7af2d6ca-4fe1-3e9a-be85-3f65f7120bd0
测试开发
浏览量:70399
533896eb-dd7b-3cde-b4d3-cc1ce02c1c14
晨记
浏览量:0
社区版块
存档分类
最新评论

[Android]calabash-android再深入

阅读更多
1.遇见的问题,client与test-server版本不一致
解释:client指代的是gem包的版本,test-server指代的是calabash-android源码下/ruby-gem/test-server的版本,下载下来源码自然就是这个版本不提供更新卸载等功能,但是client端可以控制
2.也可以修改gitclone源码下的calabash-android源码,将version对比修改正确,但不保证兼容性
3.遇到http请求无法连接到模拟器,模拟器接收不到消息,app_runing返回结果为flase,是因为gem安装包内的operations.rb文件内的server_port没有值,修改一下就好,最好也修改一下源码的http请求,添加read_timeout,以及open_timeout。

如此解决calabash无法运行的问题了。

然后再讲解一下calabash-android console命令行用法:
参考文章:http://sriram-iyengar.blogspot.com/2013/04/android-setting-up-calabash-android-for.html

大致的意思是:
calabash-android console xxxx.apk
然后可以执行githup上的query语句了,很爽的说。
点击第6个imageview,加入进货单
irb(main):030:0> touch("imageview index:6")
{
             "success" => true,
             "message" => "",
    "bonusInformation" => []
}
查看当前有多少个imageview
irb(main):027:0> query("imageview").count
11
点击list列表里的第一个
irb(main):083:0> performAction('press_list_item', 1, 0)
{
             "message" => "",
    "bonusInformation" => [],
             "success" => true
}
performAction('get_list_item_text')  获取每个item的text文本
performAction('get_url') 获取当前webview的url
performAction('drag',50,50,70,1,10)  下拉一屏,按百分比
performAction( 'get_list_item_properties', '1' , 1 )['bonusInformation']  获取item的属性
performAction('dump_body_html') 获取当前webview源码
通过webview属性进行点击
irb(main):004:0> performAction('click_by_selector',"a[href='/touch/seller/sellerOfferList?sellerOfferType=AUDITING']")
{
             "message" => nil,
    "bonusInformation" => [
        [0] "true"
    ],
             "success" => true
}
执行webview JS脚本
performAction('execute_javascript',"(alert('aaa'))")

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics