Add actions to scripts

Many actions can be added to your scripts using the MITE interface. Actions can enable scripts to be more flexible in dealing with dynamic websites, or provide for special requirements, like validating that a web page has a certain object.

Action types

Adding an action

  1. Start recording the script you want to add actions to or create a new empty script in the script repository (contextual menu on the script repository, new script).
  2. Either during or after recording, right click the step in the script where you want the action to be added and select Add Action > [action type] > [specific action].
    Select advanced action<figcaption><p>Select advanced action</p>

</figcaption></figure>

Once the action is added, move the action where you want it to be executed. From the context menu you can move an action up or down within a page or even move it to another page. The position of the action within the page will determine the order it will be executed by the script engine.

  1. Enter any values necessary for the action in the Script Action Properties area.
    Action details<figcaption><p>Action details</p>

</figcaption></figure>

Most actions have one or more properties that you need to specify in the Script Action Properties pane. Many properties can be entered as constant values, as JavaScript variables, or as a virtual profile if your script contains virtual profiles. You can define a script virtual profile in the script property pane.

Advanced actions

Add JavaScript

This option allows you to enter JavaScript into the script to be executed when the script is run. Supply JavaScript code to be executed in the src field.

Users can make use of MDP scripting commands to provide advanced scripting functions in the JavaScript entered here. Also, special MDP objects are available, which, for example, can be used to access detail about the device being used for emulation.

Add custom header

Modifies or sets an HTTP header value for the given header name.

  • Value - Value of the custom header.
  • Header - Name of the custom header.

Advanced HTTP POST

Generate an HTTP post action.

  • URL - URL of the HTTP post.
  • Content Type - Content type of the HTTP post.
  • HTTP POST Variables - List of parameters you want to POST to the server, one parameter per line. Format: name=value
  • HTTP Cookies - List of cookies you want to set while posting to the server, one cookie per line. Format: name of cookie, value of cookie, domain of cookie, path of cookie.

Clear local storage

HTML 5 provides the option of persistent data storage of key-value pair data in web clients. The Clear Local Storage action clears any data that has been saved locally.

Override DNS

DNS override forces the retrieval of content from a particular domain or IP address. DNS Override commands give you the power to specify the alternate domain or the IP you want all request to go to. This advanced scripting feature allows recording one script and iteratively running it across different domains and or IPs. This allows you to compare performance of mobile sites across different environments such as development, QA, and production.

Enter a list of host names with IP addresses. The format of the list should be “IP=host”, with only one host per line.

For example:* 127.0.0.1=localhost*

DNS Override does not affect the computer’s DNS settings; only MITE is affected.

There is no limit in the size of the DNS table with multiple AddDNSEntry call in the script.

Clear DNS override table

Clear the DNS override table previously set.

Set geolocation

MITE simulates different locations by sending GPS coordinates. This lets you verify location specific content on HTML5 websites that support the geolocation API.

You can enter a location that will be emulated by the script. Enter the latitude and longitude in decimal format.

Longitudes west of the Greenwich meridian, and latitudes south of the equator are indicated as negative values. Longitude and latitude information can be found on various websites.

Set device orientation

Select a value from the drop down menu to select the orientation to be used when the script is run:

Portrait (Default)
Turn right
Turn left
Turn upside down

Set User Agent suffix

Append a suffix to be added to the user agent screen. Default is KMWP. This can help you filter MITE/MWP traffic from your web logs.

Stop on error

Stops the script execution when an error is encountered.

Options:

  • True - Stop the script on error (default).
  • False - Continue execution when the action ends in error.

Stop script

Stops script execution with a specific error code.

Input actions

Enter value Enters the value to the element after matching the ID of the element or the name. The name can also use extended syntax to point to a specific element using map.select: (XPath of the element)
Input password Enter a value in a text/input box.
  • Value - Value to be entered in the input box.
  • Name - Name of the input box where the value is to be entered.
  • Position - Position of the input box where the value is to be entered.
Input value The function allows you to enter text in an input field. Supply a value to input to the element selected by the ID attribute or name. The name can use extended syntax to point to a specific element using map.select: {XPath of the element}. Note: option and value are exclusive: if name is not empty then position is not used.
  • Value - “1” or “0” if a check box or radio button is to be selected or unselected.
  • Name - Name of the SELECT or radio button or checkbox.
  • Position - Position of the option - index starts at 0. Note: option and value are exclusive: if name is not empty then position is not used.
  • Option - Value that has to be found in the option.
Select value Selects a value from a form.
  • Value - “1” or “0” if a check box or radio button is to be selected or unselected.
  • Name - Name of the select or radio button or check box.
  • Position - Position of the options. Index starts at 0. Note: Option and value are exclusive: if name is not empty then position is not used.
  • Option - Value that has to be found in the option.
Select value filter Select an option from a select value with advanced options.
  • Value that should not be found - Value that shouldn’t be found in the option.
  • Name - Name of the select.
  • Start position - Index of the option to start.
  • Value - Value that must be found in the option.

Navigation actions

Click URL Navigates to the given website. The input parameter is the URL of the website to open. The HTTP GET method is used.
Click name Navigates to a page using the given Name.
Click name with wildcards Navigates to a page using the given Name or Url, or Accesskey or Position in the given order. Name can also use extended syntax to point to a specific element using map.select (XPath of the element).
Click on a link Navigates to a page using the given LinkName, or Url, or Accesskey or Position in the given order.
  • (String) LinkName – name of the link you want to click.
  • (String) Url – url of the link you want to click.
  • (String) AccessKey- accesskey attribute of the link you want to click.
  • (Integer) Position – position of the link you want to click.
Click on XPath Navigates to a page using the given XPath.
Follow link Navigates to a page using the given Name, or URL, or Accesskey or Position in the given order. Name can also use extended syntax to point to a specific element using map.select (XPath of the element).
Go back Navigates back to the previous page, like clicking the back button of the browser.
Go forward Click the forward button of the browser.
Navigate Navigates to the given website. The input parameter is the URL of the website to open. The HTTP GET method is used.
Swipe or tap Touch events simulate a tap or swipe on a touchscreen device. A tap represents touching one point on a touchscreen device. A swipe represents a touch at one point and movement to a second point on the touchscreen. If only an “element_from” details are specified, the touch is a tap. If both “element_from” and “element_to” are specified, it is a swipe. For a swipe you can specify a number of in-between locations (touch_steps), and a touch_duration, which is the amount of time spent on each in-between location in milliseconds.
If an element_from or element_to XPath is given, the x/y offsets apply to the elements specified. Otherwise, they are relative to the whole screen.
  • element_from - XPath specification for an element where the tap, or beginning of the swipe, occurs.
  • element_from_offsetX - x-axis pixel location for the tap, or beginning of the swipe.
  • element_from_offsetY - y-axis pixel location for the tap, or beginning of the swipe.
  • touch_steps - number of in-between steps of a swipe.
  • element_to - XPath specification for the final point of the swipe.
  • element_to_offsetX - x-axis pixel location for end of the swipe.
  • element_to_offsetY - y-axis pixel location for end of the swipe.
  • touch_duration - number of milliseconds spent at each in-between location.

SMS actions

SMS script actions are only operational in deployed MWP scripts.

Click URL in SMS received Finds and clicks a link in an incoming SMS.
Send an SMS Enter a phone number and SMS text content.
Test an SMS short code
  • Short code number - Enter the short code number.
  • Short code keyword - Enter the short code content.
  • Validaton string - Enter a string to look for to confirm short code has been received..
  • Short code timeout - Enter time to wait for validation.
Wait for an incoming SMS Enter a phone number, text to wait for, and a timeout in seconds.

Validation actions

Search in link Searches in all collected links on the page for the given string.
  • Negation - True = word is found; False = word is not found.
  • word - the word or phrase to be searched for.
  • case_sensitive - True = text case must match; False = text case need not match.
Search in page Searches inthe page for the given string.
  • Negation - True = word is found; False = word is not found.
  • word - the word or phrase to be searched for.
  • case_sensitive - True = text case must match; False = text case need not match.
Search in title Searches in the web page title for the given string.
  • Negation - True = word is found; False = word is not found.
  • word - the word or phrase to be searched for.
  • case_sensitive - True = text case must match; False = text case need not match.