Silk Mobile

Table of Contents (Homepage)

PressWhileNotFound

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:

Press on a certain element (ElementToClick) while another element (ElementToFind) is not found

Parameters

  • Zone: Zone of elementToClick element

  • ElementToClick: query to identify the element to click.

  • ElementToClickIndex: Index of the element to click

  • ElemenToFind: query to identify the element which is looked for.

  • ElementToFindIndex: Index of the element to find

  • Timeout: Waiting Timeout in milliseconds

  • Delay: The time to wait between rounds

Example

Scenario: In the following example we will use the EriBank demo application.

Step 1: Login to the application

Step 2: Click the Expense Report button

Step 3: We will use the add button to add Expense reports on the page

We want to add 4 reports before we stop.

images/download/attachments/3310595/image40.gif

Console log:

The result:

The add button was pressed 4 times until Expense: 4 was created.

images/download/attachments/3310595/image42.gif

Code Examples

Java Example
client.pressWhileNotFound("NATIVE", "xpath=//*[@text='Add']", 0, "xpath=//*[@text='Expense : 4']", 0, 10000, 100);
C# Example
client.pressWhileNotFound("NATIVE", "xpath=//*[@text='Add']", 0, "xpath=//*[@text='Expense : 4']", 0, 10000, 100);
Python code snippet:
 self.client.pressWhileNotFound2("NATIVE", "xpath=//*[@text='Add']", 0, "xpath=//*[@text='Expense : 4']", 0, 10000, 100)
Perl code snippet:
 $client->pressWhileNotFound2("NATIVE", "xpath=//*[\@text='Add']", 0, "xpath=//*[\@text='Expense : 4']", 0, 10000, 100);