Posts Tagged ‘modifier’

MonkeyTalk Command:

MonkeyTalk Commands are very easy to understand. Even non programmer can easily  understands the MonkeyTalk commands.

MonkeyTalk commands are newline terminated and have the following syntax:
ComponentType  MonkeyId  Action  Argumets  Modifiers

These all are parts of MonkeyTalk commands. ComponentType.Action is known as the command name. MonkeyTalk command are terminated by new line.

Description of each part of MonkeyTalk command:

ComponentType:

This part ofMonkeyTalk command is required field i.e. mandatory field. In this part you have to mention the type of component on which we want to perform action. For example Button, Slider, Spinner etc. Component types are not case sensitive.

MonkeyId:

  • This part ofMonkeyTalk command is also a required field i.e. mandatory field. An identifier that is used to distinguish between components of the same type being displayed simultaneously.
  • Monkeytalk ids are case sensitive.
  • MonkeyId can be specified as asterisk (*), which finds the first matching component.
  • MonkeyId’s can also be specified as a 1-based (not zero-based) index of the form #N.

Action:

This part ofMonkeyTalk command is also a required field i.e. mandatory field. In this field you have to mention the action to be performed. Examples Tap, Select, Drag, Swipe, EnterText. Actions are not case sensitive.

Arguments:

This part ofMonkeyTalk command is not a required field. It is required according to ComponentType and Action .Arguments are separated by space. If an Argument is required but not specified,it takes on a default value.

Modifiers:

It is an optional field. There are three system-defined modifiers:

  • %timeout – how long in ms to continue retrying a command before timing out
  • %thinktime – how long in ms to wait before executing the command for the first time
  • %retrydelay – how long in ms to delay between retry attempts

IMPORTANT POINTS (points to be remembered)

  • MonkeyIds and Args are case-sensitive, but CommandTypes and Actions are not.
  • All tokens are space-separated.
  • Values with embedded blanks must be enclosed in quotes.

Example:

Tap on a button with label login:

In MonkeyTalk i.e. in .mt form

Button LOGIN tap %thinktime=3000

In javascript form i.e. in .js

this.app.button(“LOGIN”).tap({thinktime:”3000″});

Where button is componenttype, login is monkeyid and Tap is action and thinktime is modifier.