How take a property inside an element in calabash-ios and calabash-android

Hello mate !

 

I am writing about “How take a property inside an element in calabash-ios”, look the examples:
 

IOS

– This query is taking the property :TextContent for the element in a web page.

 

 query("WebView css:'#testid'")[1]["textContent"]

 
– This query is taking the property :TextContent for the element.

 

 query("Label index:1",:textContent)
 

– Look when you want a sub-property:

 

[

[0] {

     "id" => "login_button",

     "enabled" => true,

     "contentDescription" => nil,

     "class" => "android.widget.Button",

     "text" => "Login",

     "rect" => {

     "center_y" => 545.0,

     "center_x" => 639.5,

     "height" => 64,

     "y" => 513,

     "width" => 195,

     "x" => 542

               },

     }

]

– This query is taking the property inside the group of properties.

 

 query("Label").first["rect"]["y"]

 

 
Android

– This query is taking the property :TextContent for the element in a web page.

 query("WebView css:'#testid'",:textContent)
 
– This query is taking the property :TextContent for the element.

 

 query("Label index:1",:textContent)
 

– Look when you want a sub-property:

 

 [

[0] {

     "id" => "login_button",

     "enabled" => true,

     "contentDescription" => nil,

     "class" => "android.widget.Button",

     "text" => "Login",

     "rect" => {

     "center_y" => 545.0,

     "center_x" => 639.5,

     "height" => 64,

     "y" => 513,

     "width" => 195,

     "x" => 542

               },

     }

]

 

– This query is taking the property inside the group of properties.

 

 query("Label index:1",:rect,:y)
 

If you need help or have some comment to do, please write below 🙂
 
Thank you !