2016-08-09 61 views
0

我打算使用葫蘆,Android的開發自動測試腳本的Android應用程序。 但我不知道如何觸摸/查詢在以下頁面中的「註冊」按鈕: enter image description here如何獲得的WebView由葫蘆,Android的詳細信息?

我試圖「查詢‘*’」在葫蘆控制檯,但無法獲取有關 按鈕的任何信息。查詢輸出:

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 
     } 
    } 
] 

您能否給我些建議?非常感謝!

+0

您的應用程序:是天然的還是混合動力? –

+0

混合。謝謝! – Stephen

回答

0

我要回答這個問題想你的應用程序是一個混合的應用程序。我不確定這適用於本機應用程序。我對此表示懷疑。
如果你想獲得關於DOM所有元素的一些信息,你應該使用此指令:

query("systemWebview css:'*'") 

該指令將返回一個陣列上的Web視圖中的所有元素。

query("systemWebview css:'*' {textContent CONTAINS 'Register'}") 

檢查結果發現:如果你想獲得僅的textContent包含字寄存器(這將有助於你發現很容易),你應該用這個元素你會得到班,IDS等。我:那是你想要的嗎?

+0

我在calabash-android控制檯中檢查了兩個命令,但沒有任何回報。只需空[] – Stephen

+0

好吧。 Firstable,你確定它是一個混合應用程序?其他方式你的應用程序不會顯示任何webview。 –

+0

如何確認此應用類型?我是這些東西的新手。 – Stephen

相關問題