Since: API Level v2
public final class

XUIAPlugin

com.webmbt.plugin.XUIAPlugin

Class Overview

UIA Plugin provides a set of MScript function to automate keyboard and mouse actions.

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

Summary

Public Constructors
XUIAPlugin()
Public Methods
void click(String btnOption_p)
mouse click on left, right and middle button.
void clickAt(String x_p, String y_p, String btnOption_p)
perform mouse click at the coordinates specified.
void doubleClick(String btnOption_p)
double click mouse button using the specified mouse buttons.
void doubleClickAt(String x_p, String y_p, String btnOption_p)
perform double click at the coordinates specified.
void dragDrop(String fromX_p, String fromY_p, String toX_p, String toY_p, String btnOption_p)
performs mouse drag and drop from one position to another
String getPixelColor(String x_p, String y_p)
return the pixel color at the specified coordinates.
void keyDown(String... keyCodeList_p)
send a keybord key down event as specified in the key token.
void keyUp(String... keyCodeList_p)
send a keybord event.
void mouseDown(String btnOption_p)
send mouse event: mouse down.
void mouseMove(String x_p, String y_p)
Moves mouse pointer to given screen coordinates.
void mouseUp(String btnOption_p)
send mouse event: mouse up
void mouseWheel(String direction_p, String notchNum_p)
Rotates the scroll wheel on wheel-equipped mice.
void sendKey(String... keyCodeList_p)
send a keybord event.
void setDoubleClickMillis(String millis_p)
sets the pause time between clicks for double click action.
String snapScreen(String x_p, String y_p, String width_p, String height_p, String fn_p)
takes a snapshot of the specified rectangle region of the window screen.
String snapScreen(String fn_p)
takes a fullscreen snapshot of the window screen.
void type(String typeText)
type a text string or a single function key.
void typeWithModifier(String typeText, String modifiers_p)
type a text string into current UI element while holding down modifier keys specified.

Public Constructors

public XUIAPlugin ()

Since: API Level v2

Public Methods

public void click (String btnOption_p)

Since: API Level v2

mouse click on left, right and middle button.

Example:

$click('LR')
The above expression performs clicke action with both left and right mouse button.

Parameters
btnOption_p L for left button, M for middle button, R for right button. Specify empty value ('') for default left mouse
Throws
Exception

public void clickAt (String x_p, String y_p, String btnOption_p)

Since: API Level v2

perform mouse click at the coordinates specified.

Parameters
btnOption_p L for left button, M for middle button, R for right button. Leave this blank for normal mouse click.
Throws
Exception

public void doubleClick (String btnOption_p)

Since: API Level v2

double click mouse button using the specified mouse buttons.

Parameters
btnOption_p L for left button, M for middle button, R for right button. Specify empty value ('') for default left mouse.
Throws
Exception

public void doubleClickAt (String x_p, String y_p, String btnOption_p)

Since: API Level v2

perform double click at the coordinates specified.

Parameters
btnOption_p L for left button, M for middle button, R for right button. Leave this blank for normal double click.
Throws
Exception

public void dragDrop (String fromX_p, String fromY_p, String toX_p, String toY_p, String btnOption_p)

Since: API Level v2

performs mouse drag and drop from one position to another

Parameters
fromX_p x coordinate at start position
fromY_p y coordinate at start position
toX_p x coordinate at target position
toY_p y coordinate at target position
btnOption_p L for left button, M for middle button, R for right button. Leave this blank for normal dragdrop operation (left mouse down).

public String getPixelColor (String x_p, String y_p)

Since: API Level v2

return the pixel color at the specified coordinates.

Returns
  • color name

public void keyDown (String... keyCodeList_p)

Since: API Level v2

send a keybord key down event as specified in the key token. e.g. [KEYS.ENTER] for ENTER key down event. See Sending Keyboard Keys.

Example:

<action code="$keyDown ('[KEYS.CONTROL]')"/>
<action code="$type('this is a test')"/>
<action code="$keyUp ('[KEYS.CONTROL]')"/>

Throws
Exception

public void keyUp (String... keyCodeList_p)

Since: API Level v2

send a keybord event. key up event as specified in the key token. e.g. [KEYS.ENTER] for ENTER key up event. See Sending Keyboard Keys.

Example:

<action code="$keyDown ('[KEYS.CONTROL]')"/>
<action code="$type('this is a test')"/>
<action code="$keyUp ('[KEYS.CONTROL]')"/>

Throws
Exception

public void mouseDown (String btnOption_p)

Since: API Level v2

send mouse event: mouse down. Mouse will remain down until explicitly released with $mouseUp() or by other mouse / key action.

Parameters
btnOption_p L for left button, M for middle button, R for right button. Specify empty value ('') for default left mouse

public void mouseMove (String x_p, String y_p)

Since: API Level v2

Moves mouse pointer to given screen coordinates.

Parameters
x_p x coordinate of the screen
y_p y coordinate of the screen
Throws
Exception

public void mouseUp (String btnOption_p)

Since: API Level v2

send mouse event: mouse up

Parameters
btnOption_p L for left button, M for middle button, R for right button. Specify empty value ('') for default left mouse

public void mouseWheel (String direction_p, String notchNum_p)

Since: API Level v2

Rotates the scroll wheel on wheel-equipped mice.

Parameters
direction_p Up, others for Down.
notchNum_p number of "notches" to move the mouse wheel

public void sendKey (String... keyCodeList_p)

Since: API Level v2

send a keybord event. key event is specified in the key token. e.g. [KEYS.ENTER] for ENTER key.

See Sending Keyboard Keys.

Example:

$sendKey ('[KEYS.ENTER]','[KEYS.TAB]')

Throws
Exception

public void setDoubleClickMillis (String millis_p)

Since: API Level v2

sets the pause time between clicks for double click action. default value is 20 milliseconds.

public String snapScreen (String x_p, String y_p, String width_p, String height_p, String fn_p)

Since: API Level v2

takes a snapshot of the specified rectangle region of the window screen. The image file will be written out in jpg to the specified output file path. If output file path does not end with ".jpg", it will have ".jpg" added to the file path.

Throws
MBTException
Exception

public String snapScreen (String fn_p)

Since: API Level v2

takes a fullscreen snapshot of the window screen. The image file will be written out in jpg to the specified output file path. If output file path does not end with ".jpg", it will have ".jpg" added to the file path.

Throws
MBTException
Exception

public void type (String typeText)

Since: API Level v2

type a text string or a single function key.

See Sending Keyboard Keys.

Throws
Exception

public void typeWithModifier (String typeText, String modifiers_p)

Since: API Level v2

type a text string into current UI element while holding down modifier keys specified.

See Sending Keyboard Keys.

Parameters
modifiers_p modifier keys [KEYS.SHIFT][KEYS.CTRL]
Throws
Exception