Since: API Level v2
public final class

SeqOutPlugin

com.webmbt.plugin.SeqOutPlugin

Class Overview

provides mscript functions to output test sequences.

Copyright © 2008 - 2017 TestOptimal LLC. All Rights Reserved.

Summary

Public Constructors
SeqOutPlugin()
Public Methods
void addCustomField(String fieldName_p, String fieldValue_p)
adds a custom field to the seqout.
String addOsCmdLink(String osCmd_p, String cmdName_p)
adds a anchor to run an OS command on the server when clicked.
String callFunc(String... cmdAndParams_p)
calls a user defined function with parameters.@return
String click(String locator_p, String coordX_p, String coordY_p)
simulate click on the element that supports coordinates, for example an image.
String click(String locator_p)
simulate click on the element.
String click(String locator_p, String shiftCtrlAlt_p)
simulate click on the element with option of holding down shift, ctrl or alt key.
String containsText(String text_p)
returns true if current page contains the text passed in.
String count(String locator_p)
returns count of number of objects for the element locator passed in.
String doubleClick(String locator_p)
double click on the element.
String dragAndDrop(String fromLocator_p, String toLocator_p)
release mouse while on the element locator_p.
String getAlertText()
returns the message in the alert popup dialog if present.
String getAttr(String locator_p, String attrName_p)
Returns the value of HTML attribute value defined in the element.
String getConfirmText()
returns the message in the confirm popup dialog if present.
String getCookie(String cookieName_p)
returns the value of the cookie.
String getText(String locator_p)
Returns the text of the element.
String getTitle()
returns the title of the current window/page.
String getValue(String locator_p)
returns the value attribute of the element specified in locator.@return
String isAlertPresent()
retusn true if the alert dialog has been displayed(triggered).
String isChecked(String locator_p)
returns true if the locator_p is checked: radio button or checkbox only.
String isConfirmPresent()
retusn true if the confirm dialog has been displayed(triggered).
String isDisabled(String locator_p)
returns true if any of the elements found is disabled.
String isPresent(String locator_p)
returns true if the element exists in the current page/frame/window.
String isVisible(String locator_p)
returns true if any of the elements is visible.
String js(String winLocator_p, String javascript_p)
executes javascript passed in on the window identified in winLocator_p.
String mouseDown(String locator_p)
trigger mouse down event on element locator_p.
String mouseOver(String locator_p)
trigger mouse over event on the element locator_p.
String mouseUp(String locator_p)
trigger mouse up event on the element locator_p.
String printSetup(String message_p)
adds the message to the test case setup instructions.@return
String printTeardown(String message_p)
adds the message to the test case teardown instructions.@return
String refresh()
String rightClick(String locator_p)
rightClick on the element.
String selectFrame(String frameName_p)
select the named frame as the current default frame.
String selectOption(String locator_p, String optionLocator_p)
selects the option.
String selectWindow(String windowName_p)
select the named window as the current default window.
void seqout(String msg_p)
writes the message to the SeqOut output stream (xml).
String setCheckBox(String locator_p, String checked_p)
sets the checkbox.
void setFormatField(String fieldName_p, String fieldValue_p)
sets the format field and override the definition if already exists in seqout.fmt file.
void setOsCmdHostPort(String hostPort_p)
sets the host and port# of the server to execute osCmd.
void setPathFlag(String flag_p)
either to prevent the current test case (path) from being removed as duplicates or forces the current test case (path) to be removed.
String setRadioButton(String locator_p, String checked_p)
sets the radio button.
String setupAlert()
prepare system to handle alert popup.
String setupConfirmResponse(String bool_p)
prepare system to handle the confirmation dialog with OK/Yes or Cancel/No.
String sizeOf(String locator_p)
returns the number options in the select
void splitStep()
to have each step instruction to be written to excel in a separate row.
String type(String locator_p, String shiftCtrlAlt_p, String keyString_p)
type the string to the element with the option to have shift/control/alt key pressed.
String type(String locator_p, String keyString_p)
type the string to the element if the element is an input field.
String waitForPageToLoad()
waits for the page to finish loading.
void waitForPageToLoad(String timeoutMillis_p)
Waits until the page (Html dom) is fully loaded.
String webAuth(String authType_p, String userID_p, String password_p, String waitMillis_p, String gotoURL_p)
performs HTTP basic authentication.

Public Constructors

public SeqOutPlugin ()

Since: API Level v2

Public Methods

public void addCustomField (String fieldName_p, String fieldValue_p)

Since: API Level v2

adds a custom field to the seqout. Custom fields can be accessed / used by xsl style sheet.

For example, the following mScript adds a custom field later to be used in xsl:

Then in xsl, you would use this syntax to print the custom field:

This is equivalent to adding the following line to the seqout.fmt file except that using this mScript function is specific to each model while seqout.fmt is for all models. @myField=myVal

Note no duplication is checked. It the field is already defined in seqout.fmt, this method overrides it with the value passed in.

Parameters
fieldName_p name of the field
fieldValue_p value of the field

public String addOsCmdLink (String osCmd_p, String cmdName_p)

Since: API Level v2

adds a anchor to run an OS command on the server when clicked. Requires enableUnsecuredOsCmd=Y setting in config.properties.

By default the server host and port is set to localhost:8888, you may change this by calling $setOsmdHostPort(hostPort).

Example:

$addOsCmdLink('link name','abc.bat')

public String callFunc (String... cmdAndParams_p)

Since: API Level v2

calls a user defined function with parameters.@return

Throws
Exception
Exception

public String click (String locator_p, String coordX_p, String coordY_p)

Since: API Level v2

simulate click on the element that supports coordinates, for example an image.

Example:

<action code="$click('id=F1','100','200')"/> 

Notice that even though coordX_p and coordY_p are integer parameters, they must be enclosed by a set of single quote.

Throws
MBTException

public String click (String locator_p)

Since: API Level v2

simulate click on the element.

Example:

<action code="$click('id=F1')"/>

Throws
MBTException

public String click (String locator_p, String shiftCtrlAlt_p)

Since: API Level v2

simulate click on the element with option of holding down shift, ctrl or alt key.

Example:

<action code="$click('id=F1','S')"/> 

Throws
MBTException

public String containsText (String text_p)

Since: API Level v2

returns true if current page contains the text passed in. The text must be static text string only.

Example:

<log msg="Page contains text XXXX? $containsText('XXXX')"/> 

Throws
MBTException

public String count (String locator_p)

Since: API Level v2

returns count of number of objects for the element locator passed in.

Example:

<log msg="$found $count('name=paymentType') payment types on the screen"/> 

Throws
MBTException

public String doubleClick (String locator_p)

Since: API Level v2

double click on the element.

Example:

<action code="$doubleClick('id=F1')"/>

Throws
MBTException

public String dragAndDrop (String fromLocator_p, String toLocator_p)

Since: API Level v2

release mouse while on the element locator_p.

Example:

<action code="$dragAndDrop('id=F1','id=F2')"/> 

Throws
MBTException

public String getAlertText ()

Since: API Level v2

returns the message in the alert popup dialog if present. null if not.@return

Throws
MBTException

public String getAttr (String locator_p, String attrName_p)

Since: API Level v2

Returns the value of HTML attribute value defined in the element.

Example:

<log msg="Field attribute: $getAttr('id=F1','class')."/>

Each type of HTML element has a set of attributes but it also allows user defined attributes. For example "table" element has these attributes "id", "name", "width", "height", "class", etc. These are standard attributes to define a table in HTML. You may add any user attributes like "customerNumber", "orderNumber", "firstName", etc. These user defined attributes are also accessible by getAttr().

Throws
MBTException
See Also
  • http://www.w3schools.com/tags/default.asp

public String getConfirmText ()

Since: API Level v2

returns the message in the confirm popup dialog if present. null if not.@return

Throws
MBTException

public String getCookie (String cookieName_p)

Since: API Level v2

returns the value of the cookie.

Throws
MBTException

public String getText (String locator_p)

Since: API Level v2

Returns the text of the element. If multiple elements found, return a String with all text strung together separated by semicolon.

Example:

<log msg="$getText('id=rowTitle')"/> 

Throws
MBTException

public String getTitle ()

Since: API Level v2

returns the title of the current window/page.

Example:

<log msg="Page title is: $getTitle()"/> 

Throws
MBTException

public String getValue (String locator_p)

Since: API Level v2

returns the value attribute of the element specified in locator.@return

Throws
MBTException

public String isAlertPresent ()

Since: API Level v2

retusn true if the alert dialog has been displayed(triggered).

Throws
MBTException

public String isChecked (String locator_p)

Since: API Level v2

returns true if the locator_p is checked: radio button or checkbox only.

Example:

<log msg="The checkbox F1 checked? $isChecked('id=F1')"/> 

Parameters
locator_p locator to the checkbox
Throws
MBTException

public String isConfirmPresent ()

Since: API Level v2

retusn true if the confirm dialog has been displayed(triggered). isConfirmPresent() must be called immediately after the action that trigger the confirm popup. optionally you can call getConfirmText().

Throws
MBTException

public String isDisabled (String locator_p)

Since: API Level v2

returns true if any of the elements found is disabled.

Example:

<log msg="Field F1 disabled?: $isDisabled('id=F1')."/>

Throws
MBTException

public String isPresent (String locator_p)

Since: API Level v2

returns true if the element exists in the current page/frame/window.

Example:

<if val1="$isPresent('checkbox1')" op="eq" val2="true"/> 
    <log msg="checkbox1 is present on this page">

</if>

Throws
MBTException

public String isVisible (String locator_p)

Since: API Level v2

returns true if any of the elements is visible.

Example:

<log msg="Field F1 visible?: $isVisible('id=F1')."/>

Throws
MBTException

public String js (String winLocator_p, String javascript_p)

Since: API Level v2

executes javascript passed in on the window identified in winLocator_p.

Parameters
winLocator_p locator for the window where the javascript will be executed on. win=windowName. Null or blank to run on current (top) window.
Throws
MBTException

public String mouseDown (String locator_p)

Since: API Level v2

trigger mouse down event on element locator_p.

Example:

<action code="$mouseDown('id=F1')"/>

Throws
MBTException

public String mouseOver (String locator_p)

Since: API Level v2

trigger mouse over event on the element locator_p.

Example:

<action code="$mouseOver('id=F1')"/> 

Throws
MBTException

public String mouseUp (String locator_p)

Since: API Level v2

trigger mouse up event on the element locator_p.

Example:

<action code="$mouseUp('id=F1')"/> 

Throws
MBTException

public String printSetup (String message_p)

Since: API Level v2

adds the message to the test case setup instructions.@return

Throws
Exception

public String printTeardown (String message_p)

Since: API Level v2

adds the message to the test case teardown instructions.@return

Throws
Exception

public String refresh ()

Since: API Level v2

public String rightClick (String locator_p)

Since: API Level v2

rightClick on the element.

Example:

<action code="$rightClick('id=F1')"/>

Throws
MBTException

public String selectFrame (String frameName_p)

Since: API Level v2

select the named frame as the current default frame.

Example:

<action code="$selectFrame('frame1')"/>

Parameters
frameName_p name of the frame
Throws
MBTException

public String selectOption (String locator_p, String optionLocator_p)

Since: API Level v2

selects the option.

Example:

<action code="$selectOption('id=selectF1','value=2')"/>

Parameters
locator_p locator for the element
optionLocator_p locator for the option to be selected.
  • label=labelPattern: matches options based on their labels, i.e. the visible text. (This is the default.)

    For example, label=regexp:^[Oo]ther

  • value=valuePattern: matches options based on their values.

    For example, value=other

  • id=id: matches options based on their ids.

    id=option1

  • index=index: matches an option based on its index (offset from zero).

    index=2

Throws
MBTException

public String selectWindow (String windowName_p)

Since: API Level v2

select the named window as the current default window.

Example:

<action code="$selectWindow('mainWin')"/>

Parameters
windowName_p name of the window
Throws
MBTException

public void seqout (String msg_p)

Since: API Level v2

writes the message to the SeqOut output stream (xml).

Example:

$seqout('$getVar('var1')')

public String setCheckBox (String locator_p, String checked_p)

Since: API Level v2

sets the checkbox.

Example:

<action code="$setCheckBox('id=F1','true')"/>

Parameters
locator_p locator to the checkbox element
checked_p true or false
Throws
MBTException

public void setFormatField (String fieldName_p, String fieldValue_p)

Since: API Level v2

sets the format field and override the definition if already exists in seqout.fmt file.

public void setOsCmdHostPort (String hostPort_p)

Since: API Level v2

sets the host and port# of the server to execute osCmd. The default is localhost:8888.

Example:

$setOsCmdHostPort('localhost:8888')

public void setPathFlag (String flag_p)

Since: API Level v2

either to prevent the current test case (path) from being removed as duplicates or forces the current test case (path) to be removed.

Be aware that a test case (path) consists of multiple transitions. Example:

$setPathFlag('keep') or $setPathFlag('discard')

Parameters
flag_p either keep or discard.

public String setRadioButton (String locator_p, String checked_p)

Since: API Level v2

sets the radio button.

Example:

<action code="$setRadioButton('id=F1','true')"/>

Parameters
locator_p locator to the radiobutton element
checked_p true or false
Throws
MBTException

public String setupAlert ()

Since: API Level v2

prepare system to handle alert popup.

Call this function before the alert dialog opens up. It clears previous alert message if any.

isAlertPresent() must be called right after the action script which causes the alert to show up. optionally you may call getAlertText() after the isAlertPresent() call.

Throws
MBTException

public String setupConfirmResponse (String bool_p)

Since: API Level v2

prepare system to handle the confirmation dialog with OK/Yes or Cancel/No.

Call this function before the confirmation dialog opens up.

It clears previous confirm dialog message if any. isConfirmPresent() must be called right after the action script which causes the confirm to show up. optionally you may call getConfirmText() after the isConfirmPresent() call.

Throws
MBTException

public String sizeOf (String locator_p)

Since: API Level v2

returns the number options in the select

Throws
MBTException

public void splitStep ()

Since: API Level v2

to have each step instruction to be written to excel in a separate row. This is equivalent to setting the plugin argument in config.property "-splitStep".

Throws
Exception

public String type (String locator_p, String shiftCtrlAlt_p, String keyString_p)

Since: API Level v2

type the string to the element with the option to have shift/control/alt key pressed.

Example:

<action code="$type('id=F1','S','abc')"/>

Parameters
shiftCtrlAlt_p include char "c" for control key, "a" for alt key and "s" for shift key. For example "cs" to have control and shift keys pressed.
Throws
MBTException

public String type (String locator_p, String keyString_p)

Since: API Level v2

type the string to the element if the element is an input field.

Example:

<action code="$type('id=F1','abc')"/>

Throws
MBTException

public String waitForPageToLoad ()

Since: API Level v2

waits for the page to finish loading. For more reliable way to detect a load is complete, use $waitForElement()

public void waitForPageToLoad (String timeoutMillis_p)

Since: API Level v2

Waits until the page (Html dom) is fully loaded. This does not include the dynamic content created by javascript and ajax call.

Parameters
timeoutMillis_p max number of milliseconds to wait until it timesout.
Throws
MBTException

public String webAuth (String authType_p, String userID_p, String password_p, String waitMillis_p, String gotoURL_p)

Since: API Level v2

performs HTTP basic authentication.

Parameters
authType_p "HttpBasicAuth", more authentication types may be added in the future.
userID_p user id/name
password_p password
waitMillis_p number of milliseconds to wait for the authentication to execute
gotoURL_p AUT url
Throws
Exception