Silk Mobile

Table of Contents (Homepage)

ElementGetProperty

Note: Commands work only after application preparation.

ElementGetProperty(Zone, Element, Index, Property)

images/images/os-icons/os_ios_150x150.png

images/images/os-icons/os_android_150x150.png

images/images/os-icons/os_windows_150x150.png

images/images/os-icons/os_blackberry_150x150.png

Description

Command to get a property of an element. Can retrieve all properties of the elements that are showing on the object spy as also controllers.

Parameters

  • Zone: Select Zone

  • Element: Select Element

  • Index: Element index

  • Property: Property

Supported properties:
All available properties from the object spy.

Additional supported properties:

  • index: For android and iOS pickers to get the element in the picker in the provided index.

  • date: Works on Android and iOS date picker, to get the date value.

  • datetime: Works on iOS date time picker, to get the date and time value

  • time: Works on Android or iOS time picker, to get the time value.

  • slide: Works on Android or iOS slider to get the slider value.

  • text: Works on Android or iOS picker to get the specific selected text in the picker.

  • on: Works on Android or iOS switch to get its value (true or false)

  • InnerHTML: Works on Android or iOS. Gets the inner HTML code.

  • enabled: Check if a button is enabled or disabled. Works on Android or iOS buttons.

  • checked: Check if a checkbox is checked or not. Works on Android or iOS buttons.

Note: For Windows Phone, using invalid property name on the command will be returned a list of the available properties for the current element in the error log.

Usage

Scenario 1: date pickers

In the following example we will get the selected date from a picker using the UICatalog Test application.

Step 1: Get the picker's Native id.

How to find the picker's Native properties?

Usually it can be found behind its components properties:

  1. Click on one of the picker's components.

    images/download/attachments/2688986/1.jpg
  2. Right-click on the component then click on 'Ignore' - this will remove its properties from the screen, and will let you see what's behind it.
    images/download/attachments/2688986/2.jpg

  3. Click again in the same place - the picker's properties will now show up (if not, continue ignoring until you find it)
    images/download/attachments/2688986/3.jpg

Step 2: Set the command's properties to get the selected date in the picker.

images/download/attachments/2688986/4.jpg

Result:

images/download/attachments/2688986/5.jpg

Scenario2: Sliders

In the following example we will get the selected value from a slider using the UICatalog Test application.

Step 1: Get the slider's Native id.

How to find the picker's Native properties?

Usually it can be found behind its components properties:

  1. Click on one of the picker's components.

    images/download/attachments/2688986/6.jpg
  2. Right-click on the component then click on 'Ignore' - this will remove its properties from the screen, and will let you see what's behind it.
    images/download/attachments/2688986/7.jpg

  3. Click again in the same place - the picker's properties will now show up (if not, continue ignoring until you find it).
    images/download/attachments/2688986/8.jpg

Step 2: Set the command's properties to get the selected value in the slider.

images/download/attachments/2688986/9.jpg

Result:

images/download/attachments/2688986/10.jpg

Scenario 3: Switches

In the following example we will check if a button is on or off using the UICatalog Test application.

Step 1: Get the button's Native id

How to find the picker's Native properties?

Usually it can be found behind its components properties:

  1. Click on one of the button's components.

    images/download/attachments/2688986/11.jpg
  2. Right-click on the component then click on 'Ignore' - this will remove its properties from the screen, and will let you see what's behind it.
    images/download/attachments/2688986/12.jpg

  3. Click again in the same place - the picker's properties will now show up (if not, continue ignoring until you find it)
    images/download/attachments/2688986/13.jpg

Step 2: Set the command's properties to get the selected value in the slider.

images/download/attachments/2688986/14.jpg

Result:

images/download/attachments/2688986/15.jpg

Code Examples

Java Example
String str0 = client.elementGetProperty("NATIVE", "class=UIDatePicker", 0, "date");
C# Example
string str0 = client.ElementGetProperty("NATIVE", "class=UIDatePicker", 0, "date");
VBScript Example
str0 = client.ElementGetProperty ( "NATIVE", "class=UIDatePicker", 0, "date" )
Report
Python Example
var0 = self.client.elementGetProperty("NATIVE", "class=UIDatePicker", 0, "date")
Perl Example
my $str0 = $client->elementGetProperty("NATIVE", "class=UIDatePicker", 0, "date");