Silk Mobile

Table of Contents (Homepage)

GetElementCountIn

int getElementCountIn(zoneName, elementSearch, index, direction, elementCountZone, elementCount, width, height)

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

images/images/os-icons/os_symbian02_150x150.png

images/images/os-icons/os_windows_mobile_150x150.png

Description

Count the number of elements appearances in a container.

Parameters

  • Zone: Select Zone of container

  • Element Search: Select the Element container

  • Index: Element index

  • Direction: Direction to analyze. The options are UP, Down, Left, Right or Inside

  • Element Count Zone: The zone to extract the text from

  • Element Count: Select Element to count

  • Width: Width of the search ("0" indicates until the end/start of the window)

  • Height: Height of the search ("0" indicates until the end/start of the window

Usage

Similar command to getElementCount command which will count elements based on a container.

Scenario: In the following example we will count the number of buttons on the EriBank home screen.

images/download/attachments/2689442/1.jpg

Parameters:

  • Zone: set to be NATIVE

  • Element Search: set to be xpath=//*[@id='scrollView1']

  • Index: set to be 0

  • Direction: set to be Inside

  • Element Count Zone: set to be NATIVE

  • Element Count: set to be class=android.widget.Button

  • Width: set to be 0

  • Height: set to be 0

Result: Upon execution of this command, we will be able to see the count as 4.

images/download/attachments/2689442/2.jpg

Code Examples

Java Example
int int0 = client.getElementCountIn("NATIVE", "xpath=//*[@id='scrollView1']", 0, "Inside", "NATIVE", "class=android.widget.Button", 0, 0);
C# Example
int int0 = client.GetElementCountIn("NATIVE", "xpath=//*[@id='scrollView1']", 0, "Inside", "NATIVE", "class=android.widget.Button", 0, 0);
VBScript Example
int0 = client.GetElementCountIn ( "NATIVE", "xpath=//*[@id='scrollView1']", 0, "Inside", "NATIVE", "class=android.widget.Button", 0, 0 )
Report
Python Example
var0 = self.client.getElementCountIn("NATIVE", "xpath=//*[@id='scrollView1']", 0, "Inside", "NATIVE", "class=android.widget.Button", 0, 0)
Perl Example
my $int0 = $client->getElementCountIn("NATIVE", "xpath=//*[\@id='scrollView1']", 0, "Inside", "NATIVE", "class=android.widget.Button", 0, 0);