Silk Mobile

Table of Contents (Homepage)

ClickOffset

void click (zone, element, index, ClickCount, X, Y)

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

Click an element with an offset

Parameters

  • Zone: Select Zone

  • Element: Select "Element"

  • Index: Element Order

  • Click Count: Number of Clicks

  • X: X offset in pixel from center of the element (optional)

  • Y: Y offset in pixel from the center of element (optional)

Usage

Command usage: There is the possibility to use the extended version of the click command.

There are two additional parameter you need to give

  • X: Horizontal Offset from Element. "+" before the number in X field means Right and "-" means Left.

  • Y: Vertical Offset from Element. "+" before the number in Y field means Down and "-" means Up.

Scenario: In the following example I will click on the"Last Name" field.

To press on the 'First Name' text field you can use the "click" command, and set the vertical offset so that the click will be executed under the label and in the text field.

Parameters:

  • Zone: set to be "WEB"

  • Element: set to "text=First Name"

  • Index: set to 0

  • Click count: number of clicks - set to 1

  • X: The vertical offset from the middle of the object – set to 0

  • Y: The horizontal offset from the middle of the object– set to 20

Result: The element will be recognized but the Click event will be sent on an offset to the text field.

images/download/attachments/2688846/2.jpg

Code Examples

Command is available on all supported code languages

Java Example
client.click("WEB", "text=First Name", 0, 1, 0, 20);
C# Example
client.Click("WEB", "text=First Name", 0, 1, 0, 20);
VBScript Example
client.Click "WEB", "text=First Name", 0, 1, 0, 20
Report
Python Example
self.client.clickOffset("WEB", "text=First Name", 0, 1, 0, 20)
Perl Example
$client->clickWithOffset("WEB", "text=First Name", 0, 1, 0, 20);