Native step argument reference

This section lists the actions and roles of the TruClient native objects that are specific to the Mobile Center integration.

Mandatory argument values are indicated by an asterisk in the Step editor. Data types are shown in italics in the tables below.

To learn more about the step arguments, view their tooltips in the Step editor.

Device actions

(Windows Phone indicated by WP)

Action OS

Description

Set Orientation Android, iOS, WP

Sets the device orientation.

Arguments:

  • Orientation. The orientation of the device; String

SMS Received Android, iOS, WP

Sends the AUT to the background when an SMS is received.

Arguments:

  • Respond to event. If True, the device responds to the incoming SMS; Boolean

  • Background Time. The amount of time (in seconds) the AUT stays in the background; Integer Min: 0; Default: 10

  • From. The number of the SMS sender; String

  • Body. The content of the SMS; String

Call Received Android, iOS, WP

Sends the AUT to the background when a call is received.

Arguments:

  • Respond to event. If True, the device responds to the incoming call; Boolean

  • Background Time. The amount of time (in seconds) the AUT stays in the background; Integer Min: 0; Default: 10

  • From. The number of the caller; String

Press Key Android, iOS, WP

Presses a key on a keyboard including non-alphanumerical values, such as Space, Delete, and the expansion of the keyboard to show more numbers or characters.

Arguments:

  • Key. The key to input.

Location Changed Android, iOS, WP

Sets the device location to a new physical location.

Arguments:

  • Latitude. Min: -90; Maximum: 90

  • Longitude. Min: -180; Maximum: 180

To Background Android, iOS, WP

Sends the AUT to the background.

Argument:

  • Background Time. Amount of time (in seconds) the AUT stays in the background. ; Integer Min: 1; Max: 10

Type Android, iOS, WP

Types in text.

Argument:

  • Value. The text to enter; String
  • Typing Interval. The average time in milliseconds between keystrokes; Integer Min: 200; Max: 3000; A value of 0 indicates no wait between the keystrokes.
Swipe Android, iOS, WP

Performs a swipe in the specified direction.

Arguments:

  • Direction. The direction of the swipe; String

  • Start X Offset/Start Y Offset. The x and y coordinates at which to start the swipe. The specified x and y coordinates are relative to the upper left corner of the device; Float

  • Number of Touches (iOS only). The number of points to touch, emulating the number of fingers you would use for the gesture on a real device; Integer

Switch Keyboard Layout iOS

Switches the keyboard layout from letter to numbers and back.

Arguments:

  • Layout. The keyboard layout: numbers(default) or letters.

Press Home Android, WP

Presses the device's Home button.

Press Back Android, WP

Presses the device's Back button.

Press Menu

Android

Presses the device's Menu button.

Press Recent Apps Android

Opens the list of recent apps.

Press Enter Android

Presses the device's keypad enter button. (Relevant only in apps that support it.)

Press Search Android

Presses the device's keypad search button (Relevant only in apps that support it.)

Press Delete Android

Presses the device's delete button, if it exists.

Touch Android, iOS, WP

Simulates a Touch action on the device.

Arguments:

  • X/Y Coordinate. The x/y coordinates of the touch. The specified x and y coordinates are relative to the upper left corner of the device; Float

Note: The touch operation is recorded in Analog mode. This is used as a workaround for objects that are not supported by Mobile Center.

Scroll

Android

Scrolls an object into view.

Arguments:

  • Direction. The direction of the scroll operation; String

  • Object index. The index of the scrollable object on the screen; String

Shake iOS

Performs a Shake gesture on the device.

Back to top

WebView actions

NativeWebView role actions

Action OS

Description

Activate WebView Android, iOS

Makes the current WebView active.

WebView actions for older versions

This following actions only apply to scripts created with TruClient versions 12.53 and earlier, providing backwards compatibility.

Action

OS

Description

SetFocus

 

 

Android, iOS

Sets the focus to the browser.

SetText

 

Android, iOS

Sends text to the browser.

Arguments:

  • Value. Text to set in the input object; String

Tap

Android, iOS

Taps in the browser.

ScrollOnePage

Android, iOS

Scrolls a single page in the browser.

Arguments:

  • Direction. The direction of the scroll; String

Back to top

Browser role actions

 

Action

OS

Description

Navigate

 

 

Android, iOS, WP

Navigates to the specified URL.

Arguments:

  • Location. A URL

Refresh

 

Android, iOS, WP

Refreshes the browser window.

Back

Android, iOS, WP

Navigates back to the previously viewed page.

Forward

Android, iOS, WP

Navigates forward to the previously viewed page.

Back to top

Input role actions

Action OS

Description

Set Text Android, iOS, WP

Inputs the specified text.

Arguments:

  • Value. The text to enter in the edit box; String

If the recorded SetText action is for a password field, we strongly recommend to store the encrypted password and use the TC.decrypt function to retrieve the argument.

Set Focus Android, iOS, WP

Sets the focus on the input object.

Unfocus iOS

Removes the focus from the input object.

Back to top

ItemSelector role actions

Action OS

Description

Pick Android, iOS

Picks an item in the view.

Arguments:

  • Row index. The row index to select. Required if no Row title argument is specified; Integer

  • Row title. The row title to select. Required if no Row index argument is specified; String

  • Column index. The column index to which to apply the Row index and Row title; Integer

  • X Offset/Y Offset. The x and y coordinates of the pick. The specified coordinates are relative to the upper left corner of the object. The default value is the center of the object.; Float

Back to top

Miscellaneous actions

(Windows Phone indicated by WP)

Role > Action OS

Description

Button Android, iOS, WP Inherits all View actions.
Checkbox > Set Android, WP

Selects a check box.

Arguments:

  • Value. on/off;

Checked Label > Set Android

Selects a label.

Arguments:

  • Value. on/off;

Date Selector > Pick Android, iOS, WP

Sets the selected date, using the specified format.

Arguments:

  • Selected Date. The value to set in the Date Selector. This can be a time or a date or both.

  • Date Format. The format of the Selected Date argument.

Note: When recording a step with this method, TruClient uses one of the formats, depending on the date selector object used on the device.

When editing a step with this method, you can also use other similar formats. The format you specify in the DateFormat parameter must match the format of the string you provide in the SelectedDate argument.

Label Android, iOS, WP

Inherits all View actions.

PageControl > Set iOS

Selects the indexed page.

Arguments:

  • Index. The numeric index of the page to select; Integer Min: 0

RadioGroup > Select Android, iOS, WP

Selects the button in the radio group, by index or text.

Arguments:

One of these arguments must be specified:

  • Index. The numeric index of the button in the radio group; Integer

  • Text. The name of the button to select; String

RatingBar > Select Android

Selects the rating value.

Arguments:

  • Value. The rating value to select in the rating bar.

Slider > Slide Android, iOS, WP

Moves the slider to the specified position.

Arguments:

  • Value. The new position for the slider.

Possible values for position are determined by the range of the slider.

Stepper > Tap iOS

Increments the stepper.

Arguments:

  • Value. increment/decrement

Switch > Set Android, iOS, WP Turns the switch on or off.

Arguments:

  • Value. on/off

TabBar > Select Android, iOS, WP

Selects a tab.

Arguments:

One of the following must be specified:

  • Index. The 0-based index of the tab to select; Integer

  • Text. The name of the tab to select; String

Toggle Button > Set Android

Toggles a button on or off.

Arguments:

  • Value. on/off

Back to top

CollectionView role actions

Action OS

Description

Scroll iOS

Scrolls to an item and section in the collection view.

Arguments:

Specify either the Item and Section parameters or the x/y offset parameters.

  • Item/Section. The numeric index of the item and section to which to scroll; Integer Min: 0
  • X Offset/Y Offset. The x and y coordinates of the scroll, relative to the upper left corner of the object. The default value is the center of the object; Float
Select iOS

Selects an item and section in the collection view.

Arguments:

  • Item. The index of item to select in the collection; Integer

  • Section. The section to select inside the item; Integer

  • X Offset/Y Offset. The x and y coordinates of the selection. The specified coordinates are relative to the upper left corner of the object. The default value is the center of the object; Float

Unselect iOS

Deselects an item and section in the collection view.

Arguments:

  • Item. The numerical index of the item to select in the collection; Integer

  • Section. The numerical index of the section to select within the item; Integer

ScrollOnePage iOS

Scrolls the collection view one page over in the selected direction.

Arguments:

  • Direction. The direction to scroll; String

ScrollToTop iOS

Scrolls to the top of the collection view.

Back to top

Scroller role actions

(Windows Phone indicated by WP)

Action OS

Description

Scroll Android, iOS, WP

iOS only: Scrolls the element the specified number of pixels.

Arguments:

  • X Offset/Y Offset. The x/y coordinates of the scroll.

Note: The specified coordinates are relative to the upper left corner of the object. The default value is the center of the object.

Android and WP: No arguments. The scroll location is decided according to the internal object representation.

Zoom iOS

Enlarges or decreases the object view according to the specified scale.

Arguments:

  • X Offset/Y Offset. The x/y coordinates of the zoom. The specified coordinates are relative to the upper left corner of the object. The default value is the center of the object; Float

  • Scale. The zoom scale (0.5 to reduce to half, 2 to double the size, and so on); Float

ScrollOnePage Android, iOS

Scrolls the page up or down in the selected direction.

Arguments:

  • X Offset/Y Offset (Android only): The x/y coordinates at which to start the scroll. The specified coordinates are relative to the upper left corner of the object. The default value is the center of the object; Float

  • Direction. The direction to scroll (up or down); String

Back to top

Table role actions

(Windows Phone indicated by WP)

Action OS

Description

Tap iOS

Taps the table where specified.

Arguments:

  • Row. The index of the row in the table to tap on; Integer Min: 0

  • Section. The numeric index of the section in the table that contains the row to tap on; Integer Min: 0

  • X Offset/Y Offset. The x/y coordinates to tap inside the table; Float

RemoveTableRow iOS

Deletes a row from the table.

Arguments:

  • Row. The numeric index of the row to delete; Integer Min: 0

  • Section. The numeric index of the section from which to delete the row; Integer Min: 0

Select Android, iOS, WP

Selects a row in a section in the table.

Arguments:

  • Row. The index of the row in the table to select; Integer

  • Section. The numeric index of the section in the table that contains the row being selected; Integer

  • X Offset/Y Offset. The x/y coordinates to select inside the table; Float

SelectByLabel iOS

Selects a row in a section in the table.

Arguments:

  • Label. The label of the row to select; String

Scroll Android, iOS, WP

Scrolls up or down.

Arguments:

Tip: Optional. For iOS, specify either the Row and Section parameters or the x/y-offset parameters.

  • Row. The row index in the table to tap on; Integer

  • Section. The section containing the row to tap on, usually the column; Integer

  • X Offset/Y Offset (iOS only). The x/y offsets (in pixels) inside the table. If you use these arguments, set the x-offset to 0. ; Float

    Note: The specified coordinates are relative to the upper left corner of the table.

ScrollByLabel Android, iOS, WP

Scrolls to a specific label.

Arguments:

  • Label. The label text; String

ScrollOnePage Android, iOS, WP

Scrolls forward, backward, left, or right.

Arguments:

  • Direction. The direction to scroll; String

ScrollToTop iOS

Scrolls to the top of the table.

Insert iOS

Inserts a row in the table.

Arguments:

  • Row. The index of the row to insert; Integer Min: 0

  • Section. The index of the section in which to insert the row.; Integer Min: 0

Delete iOS

Deletes a row from the table.

Arguments:

  • Row. The index of the row to delete; Integer
  • Section. The index of the section from which to delete the row; Integer
Move iOS

Moves a row to a new location in the table.

Arguments:

  • Source row. The index of the row to move; Integer

  • Destination row. The index of the new location for the row; Integer

  • Source section. The numeric index of the section that contains the Source row; Integer

  • Destination section. The numeric index of the section that contains the Destination row; Integer

Back to top

View role actions

Action OS

Description

Tap Android, iOS, WP

Simulates tapping on the device's screen.

Arguments:

  • X Offset/Y Offset. Horizontal and vertical offset values; Float

    The combination of the x/y offsets gives the point of the tap. This is optional since the tap location is based firstly on the object representation, and only then on the x/y offsets.

Long Press Android, iOS, WP

Simulates a long press of the user.

Arguments:

  • Number of Taps (iOS only). The number of times to tap the object; Integer

  • Number of Touches (iOS only). The number of points to touch, emulating the number of fingers you would use for the gesture on a real device; Integer

  • Duration. The number of seconds to continue pressing; Integer

  • X Offset/Y Offset. The x and y-coordinates of the long press. The specified coordinates are relative to the upper left corner of the object. The default value is the center of the object; Float

Get Property Android, iOS, WP

Retrieves the specified property.

Arguments:

  • Property. The name of the property to retrieve; String

  • Variable. The name of the JavaScript variable to store the value for later use; String

Swipe Android, iOS, WP

Swipes the view in the specified direction.

Arguments:

  • Direction. The direction of the swipe; String

  • Start X Offset/Start Y Offset. The x and y coordinates at which to start the swipe. The specified coordinates are relative to the upper left corner of the device. The default value is the center of the device; Float

  • Number Of Touches(for iOS only). The number of points to press, similar to the number of fingers you would use for the gesture on a real device; Integer

Pan Android, iOS, WP

Performs a Pan gesture on the object.

Arguments:

  • Offsets:

    The specified coordinates are relative to the upper left corner of the object. The default value is the center of the object.

    • Start X Offset/Start Y Offset. The x and y coordinates at which to start the pan gesture; Float

    • End X Offset/End Y Offset. The x and y coordinates at which to end the pan gesture; Float

    • Velocity X Offset/Velocity Y Offset. The horizontal and vertical velocity of the pan gesture; Float

Pinch Android, iOS, WP

Performs a Pinch gesture.

Arguments:

  • Scale. The scale for the pinch gesture. This number is the ratio between the start distance and the end distance between the two touch points used for the pinch; Float

    Example: If you were to touch a screen with your fingers 6 cm apart, and pinch until your fingers were 3 cm apart, the scale would be 0.5.

  • Velocity. The speed at which to perform the pinch gesture. This number specifies the scale factor per second—i.e. the ratio between the touch point distance at one second, and the touch point distance one second later; Float

    Example: If performing a pinch from 6 cm to 3 cm (0.5 scale) takes 2 seconds, then the velocity is 0.25.

  • X Offset/Y Offset. The x and y coordinates for the pinch gesture.

    The specified coordinates are relative to the upper left corner of the object. The default value is the center of the object.; Float

Rotation iOS

Rotates the view.

Arguments:

  • Rotation. The degrees to rotate the view; Integer

  • Velocity. The speed at which to perform the rotation gesture. This number specifies the scale factor per second—that is, the ratio between the touch point distance at one second, and the touch point distance one second later; Float

  • X Offset/Y Offset. The x and y coordinates for the rotation gesture. The specified coordinates are relative to the upper left corner of the object. The default value is the center of the object; Float

Verify Android, iOS, WP

Verifies the view.

Arguments:

  • Value. The string, number, or regular expression to verify.

  • Property. The object property for which to verify the value.

  • Condition. The verification condition: "Contain", "Not Contain", "Equal", "Not Equal", "Less Than", "Greater Than", "Less Than or Equal", "Greater Than or Equal", or "Regular Expression".

Back to top

See also: