Search code examples
calabashcalabash-android

Unable to get text value in hybrid app using Calabash


We have a hybrid app built using Cordova and it has a login user and password field. The applicatio is developed based on EmberJs stack. We are using Calabash 1.* version and other components works fine except all text boxes.

I am able to successfully query the input elements using the below code in console.

query("systemWebview css:'input'")

I get the below query result in console. But text value is always empty even if I enter some value.

{
            "class" => "ember-view ember-text-field",
         "nodeType" => "ELEMENT_NODE",
               "id" => "ember555",
      "textContent" => "",
             "html" => "<input id=\"ember555\" class=\"ember-view ember-tex
ld\" placeholder=\"Enter User name\" type=\"text\">",

             "rect" => {

                 "y" => 202,

                 "x" => 0,

          "center_x" => 360,

            "height" => 74,

             "width" => 720,

               "top" => 76,

              "left" => 0,

          "center_y" => 238

      },

         "nodeName" => "INPUT",

          "webView" => "NoResourceEntry-100"
  },

In the Ruby section, I have the below code and it also returns empty value.

query(objectName, :textContent).first

Any help is appreciated. Thanks in advance.


Solution

  • Thanks to @christoper, I found some working solution for android.

    evaluate_javascript("systemWebView", "return document.getElementById('nicknameid').value;")
    

    The same logic works for checkbox validation too.