Silk Mobile

Table of Contents (Homepage)

ElementListSelect

ElementListSelect (ListLocator, ElementLocator, Index, Click)

Note: This command will work only after application preparation .

images/images/os-icons/os_ios_150x150.png

images/images/os-icons/os_android_150x150.png

images/images/os-icons/os_windows_150x150.png

Description

Select an element within a list (first making the element visible)

Parameters

  • ListLocator: List locator

  • ElementLocator: Element locator (NOTE: this variable does not support XPath queries)

  • Index: Element index

  • Click: If TRUE then click once found

Usage

Scenario: In the following example we will use the EriBank application to select an element from the country list.

Step 1: Login to the EriBank application.

Step 2: Click the Make Payment button.

Step 3: Click Select button.

The country list will be displayed on the screen.

images/download/attachments/2688887/1.jpg

Step 4: Set the elementListSelect command properties.

How to find the list locator Native properties?

Usually it can be found behind its components properties:

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

    images/download/attachments/2688887/2.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/2688887/3.jpg

  3. Click again in the same place - You will climb up the tree hierarchy of components.
    images/download/attachments/2688887/4.jpg
    images/download/attachments/2688887/5.jpg

    We have found the list locator identifier. We will use accessibilityLabel=conutryView as the identifier.

    Note the icon on the tree hierarchy for the list/table which you can use to get the table property.

Step 5: Get the Element's Native id (The option you want to pick on the list)

images/download/attachments/2688887/6.jpg

In this example we will search for Brazil

Command's properties:

To find what we are looking for.

  • ListLocator: “accessibilityLabel=conutryView”

  • ElementLocator: “text=Brazil”

  • Index: “0”

  • Click: “TRUE”

It will now select 'Brazil' (If you do not want to click on it, just set the Click property to False).

Code Examples

Command is available on all code languages: UFT (QTP), TestComplete, RFT, C#, Python, Perl, etc.

Java Example
 client.elementListSelect("accessibilityLabel=conutryView","text=Brazil", 0, true)
C# Example
client.elementListSelect("accessibilityLabel=conutryView", "text=Brazil", 0, true)
VBScript Example
client.elementListSelect"accessibilityLabel=conutryView", "text=Brazil", 0, true
Report
Python Example
self.client.elementListSelect("accessibilityLabel=conutryView", "text=Brazil", 0, True)
Perl Example
$client->elementListSelect("accessibilityLabel=conutryView","text=Brazil", 0, 1)