Silk Mobile

Table of Contents (Homepage)

SendWhileNotFound

void sendWhileNotFound(toSend, zone, elementtofind, elementtofindindex, timeout, delay)

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

Send given text while an element is not found.

Parameters

  • To Send: Text To Send

  • Zone: Select Zone

  • Element to find: Select the Element to find

  • Element to find index: Element to find index.

  • Timeout: Waiting Timeout in milliseconds

  • Delay: Time to wait before the next iteration (in milliseconds)

Usage

This command can be used in the navigation function, which will know to identify the current location in the application and navigate to any other required page. This behaves as a recovery mechanism when a test fails.

Scenario: In the following example the starting point is the countries list page in the Eribank demo application. We will use key event of {ESC} until the 'Logout' button is found to get back to the home\page of the application.

Parameters:

  • ToSend: Will be set to "{ESC}"

  • Zone: will be set to "NATIVE"

  • ElementToFind: Will be set to text=Logout

  • Element to find index: will be set to“0”

  • Timeout: Waiting Timeout in milliseconds – will be set to "7000" (7 seconds).

  • Delay: will be set to "1000" (1 second).

Result: {ESC} will be sent 3 times until the logout button is identified. Once it did, command will end and we will be able to click the logout button to get back to the login screen.

images/download/attachments/2689256/1.jpg

Code Examples

Java Example
client.sendWhileNotFound("{ESC}", "NATIVE", "text=Logout", 0, 7000, 1000);
C# Example
client.sendWhileNotFound("{ESC}", "NATIVE", "text=Logout", 0, 7000, 1000);
VBScript Example
client.SendWhileNotFound "{ESC}", "NATIVE", "text=Logout", 0, 7000, 1000
Report
Python Example
self.client.sendWhileNotFound("{ESC}", "NATIVE", "text=Logout", 0, 7000, 1000)
Perl Example
$client->sendWhileNotFound("{ESC}", "NATIVE", "text=Logout", 0, 7000, 1000);