Reputation: 248
I plan to use calabash-android to develop automation test script for android app.
But i don't know how to touch/query the "Register" button in below page:
I tried to 'query "*"' in calabash console but can not get any info about the button. The query output:
irb(main):002:0> query "*"
[
[0] {
"id" => nil,
"enabled" => true,
"contentDescription" => nil,
"visible" => true,
"tag" => nil,
"description" => "com.android.internal.policy.impl.PhoneWindow$De
corView{b11eeb10 V.E..... R.....I. 0,0-768,1134}",
"class" => "com.android.internal.policy.impl.PhoneWindow$De
corView",
"rect" => {
"center_y" => 617,
"center_x" => 384,
"height" => 1134,
"y" => 50,
"width" => 768,
"x" => 0
}
},
[1] {
"id" => nil,
"enabled" => true,
"contentDescription" => nil,
"visible" => true,
"tag" => nil,
"description" => "android.widget.LinearLayout{b10779d0 V.E..... .
.....I. 0,0-768,1134}",
"class" => "android.widget.LinearLayout",
"rect" => {
"center_y" => 617,
"center_x" => 384,
"height" => 1134,
"y" => 50,
"width" => 768,
"x" => 0
}
},
[2] {
"id" => "content",
"enabled" => true,
"contentDescription" => nil,
"visible" => true,
"tag" => nil,
"description" => "android.widget.FrameLayout{b1234b00 V.E..... ..
....I. 0,0-768,1134 #1020002 android:id/content}",
"class" => "android.widget.FrameLayout",
"rect" => {
"center_y" => 617,
"center_x" => 384,
"height" => 1134,
"y" => 50,
"width" => 768,
"x" => 0
}
},
[3] {
"id" => nil,
"enabled" => true,
"contentDescription" => nil,
"visible" => true,
"tag" => nil,
"description" => "android.widget.LinearLayout{b11ecf40 V.E..... .
.....I. 0,0-768,1134}",
"class" => "android.widget.LinearLayout",
"rect" => {
"center_y" => 617,
"center_x" => 384,
"height" => 1134,
"y" => 50,
"width" => 768,
"x" => 0
}
},
[4] {
"id" => "NoResourceEntry-6",
"enabled" => true,
"contentDescription" => "Web View",
"visible" => true,
"tag" => nil,
"description" => "org.apache.cordova.inappbrowser.InAppBrowser$6$
5{b108af68 VFEDHVC. .F....I. 0,0-768,1134 #6}",
"class" => "org.apache.cordova.inappbrowser.InAppBrowser$6$
5",
"rect" => {
"center_y" => 617,
"center_x" => 384,
"height" => 1134,
"y" => 50,
"width" => 768,
"x" => 0
}
}
]
Would you please give me some suggestions? Thanks a lot!
Upvotes: 0
Views: 818
Reputation: 159
I'm going to answer this thinking your app is an hybrid app. I'm not sure this works for native apps. I doubt it.
If you want to get some information about all your elements in DOM you should use this instruction:
query("systemWebview css:'*'")
That instruction will return an array with all elements on the web view. You'll get classes, ids, etc. If you want to get only the elements which textContent contains the word Register (which will help you find it easier) you should run this:
query("systemWebview css:'*' {textContent CONTAINS 'Register'}")
Check the results and tell me: Is that what you want?
Upvotes: 0