public class WPFBase extends TestObject implements IFocusable, IClickable, IKeyable
Modifier | Constructor and Description |
---|---|
protected |
WPFBase(JtfObjectHandle handle,
Desktop desktop)
Creates a new WPFBase with a JtfObjectHandle.
|
Modifier and Type | Method and Description |
---|---|
void |
bringIntoView()
Attempts to bring this element into view.
|
void |
click()
Clicks on the object.
|
void |
click(int button)
Clicks on the object.
|
void |
click(int button,
Point pos)
Clicks on the object.
|
void |
click(int button,
Point pos,
ModifierKey modifiers)
Clicks on the object.
|
void |
doubleClick()
Double-clicks a mouse button on the object.
|
void |
doubleClick(int button)
Double-clicks a mouse button on the object.
|
void |
doubleClick(int button,
Point pos)
Double-clicks a mouse button on the object.
|
void |
doubleClick(int button,
Point pos,
ModifierKey modifiers)
Double-clicks a mouse button on the object.
|
String |
getToolTip()
Gets the tool tip that is displayed for this element in the user interface (UI).
|
boolean |
isEnabled()
Gets a value that indicates whether this element is enabled in the user interface (UI).
|
boolean |
isFocused()
Return whether the control has focus.
|
void |
mouseMove()
Moves the pointer to the specified location in the object.
|
void |
mouseMove(Point pos)
Moves the pointer to the specified location in the object.
|
void |
openContextMenu()
Opens a context menu at the specified position.
|
void |
openContextMenu(Point pos)
Opens a context menu at the specified position.
|
void |
openContextMenuSelect(ItemPath item)
Opens a context menu and selects a menu item from the context menu.
|
void |
openContextMenuSelect(ItemPath item,
Point pos)
Opens a context menu and selects a menu item from the context menu.
|
void |
openContextMenuSelect(String item)
Opens a context menu and selects a menu item from the context menu.
|
void |
openContextMenuSelect(String item,
Point pos)
Opens a context menu and selects a menu item from the context menu.
|
void |
pressKeys(String keys)
Presses (but does not release) a set of keys or mouse buttons.
|
void |
pressKeys(String keys,
boolean ensureFocus)
Presses (but does not release) a set of keys or mouse buttons.
|
void |
pressMouse()
Presses (but does not release) a mouse button in the object.
|
void |
pressMouse(int button)
Presses (but does not release) a mouse button in the object.
|
void |
pressMouse(int button,
Point pos)
Presses (but does not release) a mouse button in the object.
|
void |
pressMouse(int button,
Point pos,
ModifierKey modifiers)
Presses (but does not release) a mouse button in the object.
|
void |
releaseKeys(String keys)
Releases a set of keys or mouse buttons.
|
void |
releaseKeys(String keys,
boolean ensureFocus)
Releases a set of keys or mouse buttons.
|
void |
releaseMouse()
Releases a mouse button.
|
void |
releaseMouse(int button)
Releases a mouse button.
|
void |
releaseMouse(int button,
Point pos)
Releases a mouse button.
|
void |
releaseMouse(int button,
Point pos,
ModifierKey modifiers)
Releases a mouse button.
|
void |
setFocus()
Gives focus to the control.
|
void |
typeKeys(String keys)
Sends a set of keystrokes to the object.
|
void |
typeKeys(String keys,
int delay)
Sends a set of keystrokes to the object.
|
void |
typeKeys(String keys,
int delay,
boolean ensureFocus)
Sends a set of keystrokes to the object.
|
void |
typePasswordKeys(String keys)
Types an encrypted password into an object, for example a text field.
|
void |
typePasswordKeys(String keys,
int delay)
Types an encrypted password into an object, for example a text field.
|
void |
typePasswordKeys(String keys,
int delay,
boolean ensureFocus)
Types an encrypted password into an object, for example a text field.
|
captureBitmap, captureBitmap, exists, exists, generateLocator, getChildren, getDynamicMethodList, getParent, getPropertyList, getRect, getRect, getText, getValue, highlightObject, highlightObject, highlightObject, invokeMethods, textCapture, textCapture, textClick, textClick, textClick, textClick, textClick, textClick, textExists, textExists, textExists, textExists, textExists, textRectangle, textRectangle, textRectangle, textRectangle, textRectangle, waitForChildDisappearance, waitForChildDisappearance, waitForDisappearance, waitForDisappearance, waitForObject, waitForObject, waitForProperty, waitForProperty
equals, exists, find, find, findAll, findAll, getCustomTypeName, getDesktop, getHandle, getLocator, getProperty, getTypeName, hashCode, imageClick, imageClick, imageClick, imageClick, imageClick, imageClick, imageClickFile, imageClickFile, imageClickFile, imageClickFile, imageClickFile, imageClickFile, imageExists, imageExists, imageExists, imageExistsFile, imageExistsFile, imageExistsFile, imageRectangle, imageRectangle, imageRectangle, imageRectangleFile, imageRectangleFile, imageRectangleFile, invoke, preventFinalLocator, setProperty, toString
protected WPFBase(JtfObjectHandle handle, Desktop desktop)
handle
- the handle that identifies the WPFBasedesktop
- the desktop on which this object livespublic void bringIntoView()
public void click()
Sample Usage
For example, in order to click on a certain position within a control, type the following:
control.click (MouseButton.LEFT, new Point(244, 16));
The following example uses the left mouse button to click in the center of the control:
control.click ();
click
in interface IClickable
public void click(int button)
Sample Usage
For example, in order to click on a certain position within a control, type the following:
control.click (MouseButton.LEFT, new Point(244, 16));
The following example uses the left mouse button to click in the center of the control:
control.click ();
click
in interface IClickable
button
- the mouse button to press. Values include: 1=left, 2=right,3=center,...public void click(int button, Point pos)
Sample Usage
For example, in order to click on a certain position within a control, type the following:
control.click (MouseButton.LEFT, new Point(244, 16));
The following example uses the left mouse button to click in the center of the control:
control.click ();
click
in interface IClickable
button
- the mouse button to press. Values include: 1=left, 2=right,3=center,...pos
- the coordinates (relative to the object) at which to clickpublic void click(int button, Point pos, ModifierKey modifiers)
Sample Usage
For example, in order to click on a certain position within a control, type the following:
control.click (MouseButton.LEFT, new Point(244, 16));
The following example uses the left mouse button to click in the center of the control:
control.click ();
click
in interface IClickable
button
- the mouse button to press. Values include: 1=left, 2=right,3=center,...pos
- the coordinates (relative to the object) at which to clickmodifiers
- the modifierpublic void doubleClick()
doubleClick
in interface IClickable
public void doubleClick(int button)
doubleClick
in interface IClickable
button
- the mouse button to press. Values include: 1=left, 2=right,3=center,...public void doubleClick(int button, Point pos)
doubleClick
in interface IClickable
button
- the mouse button to press. Values include: 1=left, 2=right,3=center,...pos
- the coordinates (relative to the object) at which to clickpublic void doubleClick(int button, Point pos, ModifierKey modifiers)
doubleClick
in interface IClickable
button
- the mouse button to press. Values include: 1=left, 2=right,3=center,...pos
- the coordinates (relative to the object) at which to clickmodifiers
- the modifierpublic boolean isFocused()
isFocused
in interface IFocusable
public void mouseMove()
mouseMove
in interface IClickable
public void mouseMove(Point pos)
mouseMove
in interface IClickable
pos
- the coordinates (relative to the window) of the new locationpublic void openContextMenu()
public void openContextMenu(Point pos)
pos
- the coordinates to open the context menu relative to the element on which this function is calledpublic void openContextMenuSelect(ItemPath item)
item
- the menu item to select. Can be either a top-level menu item or a menu item that can be found in a submenu. For selecting a menu item from a submenu separate the menu item names with a slash. The item can contain the wildcards '?' (matches one character) or '*' (matches 0 to many characters).public void openContextMenuSelect(ItemPath item, Point pos)
item
- the menu item to select. Can be either a top-level menu item or a menu item that can be found in a submenu. For selecting a menu item from a submenu separate the menu item names with a slash. The item can contain the wildcards '?' (matches one character) or '*' (matches 0 to many characters).pos
- the coordinates to open the context menu relative to the element on which this function is calledpublic void openContextMenuSelect(String item)
item
- the menu item to select. Can be either a top-level menu item or a menu item that can be found in a submenu. For selecting a menu item from a submenu separate the menu item names with a slash. The item can contain the wildcards '?' (matches one character) or '*' (matches 0 to many characters).. E.g: /Games/Applications[2]/[0]For details see ItemPath.ItemPath(String)
.
public void openContextMenuSelect(String item, Point pos)
item
- the menu item to select. Can be either a top-level menu item or a menu item that can be found in a submenu. For selecting a menu item from a submenu separate the menu item names with a slash. The item can contain the wildcards '?' (matches one character) or '*' (matches 0 to many characters).. E.g: /Games/Applications[2]/[0]For details see ItemPath.ItemPath(String)
.
pos
- the coordinates to open the context menu relative to the element on which this function is calledpublic void pressKeys(String keys)
Valid keystrokes include:
public void pressKeys(String keys, boolean ensureFocus)
Valid keystrokes include:
public void pressMouse()
pressMouse
in interface IClickable
public void pressMouse(int button)
pressMouse
in interface IClickable
button
- the mouse button to press. Values include: 1=left, 2=right,3=center,...public void pressMouse(int button, Point pos)
pressMouse
in interface IClickable
button
- the mouse button to press. Values include: 1=left, 2=right,3=center,...pos
- the coordinates (relative to the object) at which to press the mousepublic void pressMouse(int button, Point pos, ModifierKey modifiers)
pressMouse
in interface IClickable
button
- the mouse button to press. Values include: 1=left, 2=right,3=center,...pos
- the coordinates (relative to the object) at which to press the mousemodifiers
- the modifierpublic void releaseKeys(String keys)
Valid keystrokes include:
releaseKeys
in interface IKeyable
keys
- the keys or mouse buttons to releasepublic void releaseKeys(String keys, boolean ensureFocus)
Valid keystrokes include:
releaseKeys
in interface IKeyable
keys
- the keys or mouse buttons to releaseensureFocus
- determines whether it should be ensured that the control actually has the keyboard focus. Defaults to true
public void releaseMouse()
releaseMouse
in interface IClickable
public void releaseMouse(int button)
releaseMouse
in interface IClickable
button
- the mouse button to press. Values include: 1=left, 2=right,3=center,...public void releaseMouse(int button, Point pos)
releaseMouse
in interface IClickable
button
- the mouse button to press. Values include: 1=left, 2=right,3=center,...pos
- the coordinates (relative to the object) at which to release the mousepublic void releaseMouse(int button, Point pos, ModifierKey modifiers)
releaseMouse
in interface IClickable
button
- the mouse button to press. Values include: 1=left, 2=right,3=center,...pos
- the coordinates (relative to the object) at which to release the mousemodifiers
- the modifierpublic void setFocus()
setFocus
in interface IFocusable
public void typeKeys(String keys)
Valid keystrokes include:
Sample UsageFor example, the following code copies the currently selected text into the clipboard by pressing Ctrl+C:
window.typeKeys ("<Left Ctrl+C>");
public void typeKeys(String keys, int delay)
Valid keystrokes include:
Sample UsageFor example, the following code copies the currently selected text into the clipboard by pressing Ctrl+C:
window.typeKeys ("<Left Ctrl+C>");
public void typeKeys(String keys, int delay, boolean ensureFocus)
Valid keystrokes include:
Sample UsageFor example, the following code copies the currently selected text into the clipboard by pressing Ctrl+C:
window.typeKeys ("<Left Ctrl+C>");
public void typePasswordKeys(String keys)
If the object supports the SetText method, any existing text is cleared before typing the encrypted password.
Sample Usage
Sample Usage
For example, the following code encrypts a string and prints it to the console:
String encryptedPassword = desktop.encrypt("my password"); System.out.println(encryptedPassword);
You can then copy the encrypted password from the console, in this case 6Fk+Bcm+GoXe3X0=
, and use it as follows:
textField.typePasswordKeys("6Fk+Bcm+GoXe3X0=");
typePasswordKeys
in interface IKeyable
keys
- the encrypted passwordpublic void typePasswordKeys(String keys, int delay)
If the object supports the SetText method, any existing text is cleared before typing the encrypted password.
Sample Usage
Sample Usage
For example, the following code encrypts a string and prints it to the console:
String encryptedPassword = desktop.encrypt("my password"); System.out.println(encryptedPassword);
You can then copy the encrypted password from the console, in this case 6Fk+Bcm+GoXe3X0=
, and use it as follows:
textField.typePasswordKeys("6Fk+Bcm+GoXe3X0=");
typePasswordKeys
in interface IKeyable
keys
- the encrypted passworddelay
- the delay between keystrokes in millisecondspublic void typePasswordKeys(String keys, int delay, boolean ensureFocus)
If the object supports the SetText method, any existing text is cleared before typing the encrypted password.
Sample Usage
Sample Usage
For example, the following code encrypts a string and prints it to the console:
String encryptedPassword = desktop.encrypt("my password"); System.out.println(encryptedPassword);
You can then copy the encrypted password from the console, in this case 6Fk+Bcm+GoXe3X0=
, and use it as follows:
textField.typePasswordKeys("6Fk+Bcm+GoXe3X0=");
typePasswordKeys
in interface IKeyable
keys
- the encrypted passworddelay
- the delay between keystrokes in millisecondsensureFocus
- determines whether it should be ensured that the control actually has the keyboard focus. Defaults to true
public boolean isEnabled()
Copyright 2009-2012 Micro Focus. All Rights Reserved.