Silk Mobile

Table of Contents (Homepage)

SwipeWhileNotFound

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

Swipe the screen to search for an element.

Parameters

  • Direction: Direction to swipe

  • Offset: Swipe offset

  • Zone: Select Zone

  • Element to find: Select Element to find

  • Delay: Time to wait before sending a command (in milliseconds)

  • Rounds: Maximum swipe rounds

  • Click: Boolean

    • True: click on the element once it is found

    • False: Will only make the element visible

Usage

Scenario: We will use the imdb movie data application.

To swipe the screen of the ”Movies” to select “Best Picture Winners” option and then to click on it.

Parameters:

  • Direction: Down

  • Offset: 100

  • Swipe Time: 2000

  • Zone: NATIVE

  • Element to find: xpath=//*[@text='Best Picture Winners']

  • Element to find index: 0

  • Delay: 1000

  • Rounds: 5

  • Click: true

images/download/attachments/3310558/aa.jpg images/download/attachments/3310558/ca.jpg

Once found it will be clicked

images/download/attachments/3310558/b.jpg

Code Examples

Java Example
if(client.swipeWhileNotFound("Down", 0, 2000, "NATIVE", "xpath=//*[@text='Best Picture Winners']", 0, 1000, 5, true))
{
// If statement
}
C# Example
if(client.SwipeWhileNotFound("Down", 0, 2000, "NATIVE", "xpath=//*[@text='Best Picture Winners']", 0, 1000, 5, true))
{
// If statement
}
VBScript Example
If StrComp (client.SwipeWhileNotFound ( "Down", 0, 2000, "NATIVE", "xpath=//*[@text='Best Picture Winners']", 0, 1000, 5, true ), "True") = 0 Then
Report
'If statement
Else
Report
End If
Python Example
if(self.client.swipeWhileNotFound2("Down", 0, 2000, "NATIVE", "xpath=//*[@text='Best Picture Winners']", 0, 1000, 5, True)):
# If statement
pass
Perl Example
if($client->swipeWhileNotFound2("Down", 0, 2000, "NATIVE", "xpath=//*[\@text='Best Picture Winners']", 0, 1000, 5, 1)){
# If statement
}