title: how to use result of query(*) to identify textbox and button ,and use performAction and touch to input text and click button
body: <p>I have found through all of topics, but haven't found any answer related with my question. </p>
  
  <p>I test a webview apk.
  I open a url("<a href="http://m.youdao.com/" rel="nofollow">http://m.youdao.com/</a>") and want to enter text into editbox and click research button. </p>
  
  <p>The button has no id and name, see  HTML by view source of the web.</p>
  
  <p>Now query(*) works and output many things , but the question is  which one related with the textbox and which one related with the button. I want to input "test" in textbox and click search button .</p>
  
  <p>result of query :
      irb(main):006:0> query"*"
      [
          [ 0] {
                              "id" => nil,
                         "enabled" => true,
              "contentDescription" => nil,
                           "class" => "com.android.internal.policy.impl.PhoneWindow$DecorView",
                            "rect" => {
                  "center_y" => 142.0,
                  "center_x" => 120.0,
                    "height" => 284,
                         "y" => 0,
                     "width" => 240,
                         "x" => 0
              },
                     "description" => "com.android.internal.policy.impl.PhoneWindow$DecorView{b2da1390 V.E..... R.....I. 0,0-240,284}"
          },
          [ 1] {
                              "id" => "action_bar_overlay_layout",
                         "enabled" => true,
              "contentDescription" => nil,
                           "class" => "com.android.internal.widget.ActionBarOverlayLayout",
                            "rect" => {
                  "center_y" => 142.0,
                  "center_x" => 120.0,
                    "height" => 284,
                         "y" => 0,
                     "width" => 240,
                         "x" => 0
              },
                     "description" => "com.android.internal.widget.ActionBarOverlayLayout{b2dfed00 V.ED.... ......I. 0,0-240,284 #1020313 android:id/action_bar_overlay_layout}"
          },
          [ 2] {
                              "id" => "content",
                         "enabled" => true,
              "contentDescription" => nil,
                           "class" => "android.widget.FrameLayout",
                            "rect" => {
                  "center_y" => 169.5,
                  "center_x" => 120.0,
                    "height" => 229,
                         "y" => 55,
                     "width" => 240,
                         "x" => 0
              },
                     "description" => "android.widget.FrameLayout{b2da5930 V.E..... ......I. 0,55-240,284 #1020002 android:id/content}"
          },
          [ 3] {
                              "id" => "container",
                         "enabled" => true,
              "contentDescription" => nil,
                           "class" => "android.widget.FrameLayout",
                            "rect" => {
                  "center_y" => 169.5,
                  "center_x" => 120.0,
                    "height" => 229,
                         "y" => 55,
                     "width" => 240,
                         "x" => 0
              },
                     "description" => "android.widget.FrameLayout{b2df76d0 V.E..... ......I. 0,0-240,229 #7f05003c app:id/container}"
          },
          [ 4] {
                              "id" => nil,
                         "enabled" => true,
              "contentDescription" => nil,
                           "class" => "android.support.v4.app.NoSaveStateFrameLayout",
                            "rect" => {
                  "center_y" => 169.5,
                  "center_x" => 120.0,
                    "height" => 229,
                         "y" => 55,
                     "width" => 240,
                         "x" => 0
              },
                     "description" => "android.support.v4.app.NoSaveStateFrameLayout{b2e2c3b8 V.E..... ......I. 0,0-240,229}"
          },
          [ 5] {
                              "id" => nil,
                         "enabled" => true,
              "contentDescription" => nil,
                           "class" => "android.widget.LinearLayout",
                            "rect" => {
                  "center_y" => 169.5,
                  "center_x" => 120.0,
                    "height" => 229,
                         "y" => 55,
                     "width" => 240,
                         "x" => 0
              },
                     "description" => "android.widget.LinearLayout{b2df86d8 V.E..... ......I. 0,0-240,229}"
          },
          [ 6] {
                              "id" => "mywebview",
                         "enabled" => true,
              "contentDescription" => "Web View",
                           "class" => "android.webkit.WebView",
                            "rect" => {
                  "center_y" => 169.5,
                  "center_x" => 120.0,
                    "height" => 229,
                         "y" => 55,
                     "width" => 240,
                         "x" => 0
              },
                     "description" => "android.webkit.WebView{b2dbdd18 VFEDHVC. .F....I. 0,0-240,229 #7f05003d app:id/mywebview}"
          },
          [ 7] {
                              "id" => "action_bar_container",
                         "enabled" => true,
              "contentDescription" => nil,
                           "class" => "com.android.internal.widget.ActionBarContainer",
                            "rect" => {
                  "center_y" => 37.0,
                  "center_x" => 120.0,
                    "height" => 36,
                         "y" => 19,
                     "width" => 240,
                         "x" => 0
              },
                     "description" => "com.android.internal.widget.ActionBarContainer{b2dab088 V.ED.... ......I. 0,19-240,55 #1020314 android:id/action_bar_container}"
          },
          [ 8] {
                              "id" => "action_bar",
                         "enabled" => true,
              "contentDescription" => nil,
                           "class" => "com.android.internal.widget.ActionBarView",
                            "rect" => {
                  "center_y" => 37.0,
                  "center_x" => 120.0,
                    "height" => 36,
                         "y" => 19,
                     "width" => 240,
                         "x" => 0
              },
                     "description" => "com.android.internal.widget.ActionBarView{b2d98560 V.E..... ......I. 0,0-240,36 #1020315 android:id/action_bar}"
          },
          [ 9] {
                              "id" => nil,
                         "enabled" => false,
              "contentDescription" => nil,
                           "class" => "android.widget.LinearLayout",
                            "rect" => {
                  "center_y" => 37.0,
                  "center_x" => 66.5,
                    "height" => 36,
                         "y" => 19,
                     "width" => 119,
                         "x" => 7
              },
                     "description" => "android.widget.LinearLayout{b2dab638 V.....C. ......I. 7,0-126,36}"
          },
          [10] {
                              "id" => nil,
                         "enabled" => true,
              "contentDescription" => nil,
                           "class" => "com.android.internal.widget.ActionBarView$HomeView",
                            "rect" => {
                  "center_y" => 37.0,
                  "center_x" => 22.0,
                    "height" => 36,
                         "y" => 19,
                     "width" => 30,
                         "x" => 7
              },
                     "description" => "com.android.internal.widget.ActionBarView$HomeView{b2de3f00 V.E..... ......I. 0,0-30,36}"
          },
          [11] {
                              "id" => "home",
                         "enabled" => true,
              "contentDescription" => nil,
                           "class" => "android.widget.ImageView",
                            "rect" => {
                  "center_y" => 37.0,
                  "center_x" => 22.0,
                    "height" => 24,
                         "y" => 25,
                     "width" => 24,
                         "x" => 10
              },
                     "description" => "android.widget.ImageView{b2e14210 V.ED.... ......I. 3,6-27,30 #102002c android:id/home}"
          },
          [12] {
                              "id" => nil,
                         "enabled" => true,
              "contentDescription" => nil,
                           "class" => "android.widget.LinearLayout",
                            "rect" => {
                  "center_y" => 36.5,
                  "center_x" => 81.5,
                    "height" => 19,
                         "y" => 27,
                     "width" => 89,
                         "x" => 37
              },
                     "description" => "android.widget.LinearLayout{b2dda508 V.E..... ......I. 30,8-119,27}"
          },
          [13] {
                              "id" => "action_bar_title",
                         "enabled" => true,
              "contentDescription" => nil,
                           "class" => "android.widget.TextView",
                            "text" => "TestWebView",
                            "rect" => {
                  "center_y" => 36.5,
                  "center_x" => 78.5,
                    "height" => 19,
                         "y" => 27,
                     "width" => 83,
                         "x" => 37
              },
                     "description" => "android.widget.TextView{b2dbc4b8 V.ED.... ......I. 0,0-83,19 #1020265 android:id/action_bar_title}"
          },
          [14] {
                              "id" => nil,
                         "enabled" => true,
              "contentDescription" => nil,
                           "class" => "com.android.internal.view.menu.ActionMenuView",
                            "rect" => {
                  "center_y" => 37.0,
                  "center_x" => 219.0,
                    "height" => 36,
                         "y" => 19,
                     "width" => 42,
                         "x" => 198
              },
                     "description" => "com.android.internal.view.menu.ActionMenuView{b2df5188 V.ED.... ......I. 198,0-240,36}"
          },
          [15] {
                              "id" => nil,
                         "enabled" => true,
              "contentDescription" => "More options",
                           "class" => "com.android.internal.view.menu.ActionMenuPresenter$OverflowMenuButton",
                            "rect" => {
                  "center_y" => 37.0,
                  "center_x" => 219.0,
                    "height" => 36,
                         "y" => 19,
                     "width" => 42,
                         "x" => 198
              },
                     "description" => "com.android.internal.view.menu.ActionMenuPresenter$OverflowMenuButton{b2de1788 VFED..C. ......I. 0,0-42,36}"
          }
      ]
  Here is my feature and step definition.<br>
      Feature: WebView feature</p>
  
  <pre><code>  Scenario: Test WebView
  
      Then I wait for 10 seconds
  
      Then I take a picture
  
      Then I enter "test" into input field with id "formInput" 
  
      Then I wait for 100 seconds
  
      Then I take a picture
  
      Then I press the button with id "input[class='btn']" // here i don't know use which property of the button to identify it ???
  
      Then I wait for 100 seconds
  
      Then I take a picture
  
  Step definition is as bellow :
  Then /^I enter "([^\"]*)" into input field with id "([^\"]*)"$/ do |text, css|
  
  
        performAction("set_text","WebView css:'input[text=\"TestWebView\"]'",text)
  
  
  
  end
  
  
  
  Then /^I press the button with id "([^\"]*)"$/ do |css|
  
        touch ("webView css:'input[contentDescription=\"More options\"]'")
  end
  
  
  
  Then /^I touch the button with id "([^\"]*)"$/ do | css|
  
    performAction('touch','css',css)
  
  end
  
  
  
  Then /^show the html source code$/ do
  
    performAction('dump_body_html')
  
  end
  </code></pre>