Silk Mobile

Table of Contents (Homepage)

ElementSetProperty

Note: Commands work only after application preparation.

ElementSetProperty(Zone, Element, Index, Property, Value)

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

Designed command to sets value of a controller such as date pickers, sliders, switches etc..

Parameters

  • Zone - Select Zone

  • Element - Select Element (XPath is supported for the controller identifier)

  • Index - Element index

  • Property - Property (See below the supported properties)

  • Value - The value to be set

Supported properties:

NATIVE ZONE:

  • index: For pickers to selects the element in the provided index. The supported values are integers according to size of the picker

  • date: Works on Android and iOS date pickers to set the date value. The supported value format is dd.mm.yyyy: 12.09.2012

  • datetime: Works on iOS date time picker, to set the date and time value. The supported value format is dd.mm.yyyy hh.mm: 12.09.2012 13.05.

  • time: Works on Android or iOS time picker, to set the time value. The supported value format hh.mm:13.05

  • slide: Works on Android or iOS slider to set the slider value. You can set intervals like 0-10, 0-100, or 0-infinity.

  • text: Works on iOS picker to select specific text in the picker.

  • on: Works on Android and iOS switch to change the value. The supported value is boolean - true or false

  • placeholder: Works on iOS

  • checked: Works on Android or iOS check box. The supported value is boolean - true or false

WEB ZONE:

Property selection affects attributes of HTML elements. The inserted value is in javascript.

Note: String values are to be contained within quotation marks.

Usage

Scenario1: Date pickers

In the following example we will set a date to 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/2689057/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/2689057/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/2689057/3.jpg

Step 2: Set the command's properties to get the selected date in the picker in the format
DD/MM/YYYY.

images/download/attachments/2689057/4.jpg

Result: images/download/attachments/2689057/5.jpg images/download/attachments/2689057/6.jpg

Scenario2: Sliders

In the following example we will set the slider to a particular value 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/2689057/7.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/2689057/8.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/2689057/9.jpg

  4. Set the command's properties to get the selected value in the slider in integers between 0-100.
    images/download/attachments/2689057/10.jpg

Result:

images/download/attachments/2689057/11.jpg images/download/attachments/2689057/12.jpg

Scenario 3: Switches

In the following example we will change the state of a button 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/2689057/13.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/2689057/14.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/2689057/15.jpg

  4. Set the command's properties to get the selected value in the switch - boolean values of true/false.
    images/download/attachments/2689057/16.jpg

Result:

images/download/attachments/2689057/17.jpg

Code Examples

Java Example
String str1 = client.elementSetProperty("NATIVE", "xpath=//*[@class='UIDatePicker' and @hidden='false']", 0, "date", "true");
C# Example
string str1 = client.ElementSetProperty("NATIVE", "xpath=//*[@class='UIDatePicker' and @hidden='false']", 0, "date", "04.04.2015");
VBScript Example
String str1 = client.elementSetProperty("NATIVE", "xpath=//*[@class='UIDatePicker' and @hidden='false']", 0, "date", "04.04.2015");
Report
Python Example
var1 = self.client.elementSetProperty("NATIVE", "xpath=//*[@class='UIDatePicker' and @hidden='false']", 0, "date", "04.04.2015")
Perl Example
my $str1 = $client->elementSetProperty("NATIVE", "xpath=//*[\@class='UIDatePicker' and \@hidden='false']", 0, "date", "04.04.2015");