【发布时间】:2016-03-20 07:28:00
【问题描述】:
我无法触摸我的应用程序上的元素。我只能在执行命令时查询元素
query("all * text:'myText'")
返回元素不可见(在屏幕上完全可见)的结果。
"class" => "android.support.v7.widget.AppCompatTextView",
"tag" => nil,
"description" => "android.support.v7.widget.AppCompatTextView{28d7250d V.ED.... ........ 0,0-145,49 #7f100141 app:id/textLabel}",
"id" => "textLabel",
"text" => "myText",
"visible" => false,
"rect" => {
"height" => 49,
"width" => 145,
"y" => 0,
"x" => 0,
"center_x" => 72,
"center_y" => 24
},
"enabled" => true,
"contentDescription" => nil
如果我尝试这样做:
touch(query("all * text:'myText'"))
我收到以下错误:
RuntimeError: Action 'touch_coordinate' unsuccessful: Click can not be 完成!
我也试过这个解决方法:
b= query("all * text:'myText'")
touch(nil,
:offset=>{:x=>b[0]['rect']['center_x'],:y=>b[0]['rect']['center_y']})
RuntimeError:无法执行手势。 java.lang.SecurityException: 注入到另一个应用程序需要 INJECT_EVENTS 权限
有没有办法触摸这个元素?
谢谢。
【问题讨论】:
-
你能分享你的用户界面吗?
标签: android ruby automation calabash calabash-android