public class RumbaObject extends TestObject implements IFocusable, IClickable, IKeyable
Modifier | Constructor and Description |
---|---|
protected |
RumbaObject(JtfObjectHandle handle,
Desktop desktop)
使用 JtfObjectHandle 创建新 RumbaObject。
|
Modifier and Type | Method and Description |
---|---|
void |
click()
单击对象。
|
void |
click(int button)
单击对象。
|
void |
click(int button,
Point pos)
单击对象。
|
void |
click(int button,
Point pos,
ModifierKey modifiers)
单击对象。
|
void |
doubleClick()
双击对象上的鼠标按钮。
|
void |
doubleClick(int button)
双击对象上的鼠标按钮。
|
void |
doubleClick(int button,
Point pos)
双击对象上的鼠标按钮。
|
void |
doubleClick(int button,
Point pos,
ModifierKey modifiers)
双击对象上的鼠标按钮。
|
boolean |
isFocused()
返回控件是否有焦点。
|
void |
mouseMove()
将指针移至对象中的指定位置。
|
void |
mouseMove(Point pos)
将指针移至对象中的指定位置。
|
void |
pressKeys(String keys)
按住(不松开)一组键或鼠标按钮。
|
void |
pressKeys(String keys,
boolean ensureFocus)
按住(不松开)一组键或鼠标按钮。
|
void |
pressMouse()
按住(不松开)对象上的鼠标按钮。
|
void |
pressMouse(int button)
按住(不松开)对象上的鼠标按钮。
|
void |
pressMouse(int button,
Point pos)
按住(不松开)对象上的鼠标按钮。
|
void |
pressMouse(int button,
Point pos,
ModifierKey modifiers)
按住(不松开)对象上的鼠标按钮。
|
void |
releaseKeys(String keys)
松开一组键或鼠标按钮。
|
void |
releaseKeys(String keys,
boolean ensureFocus)
松开一组键或鼠标按钮。
|
void |
releaseMouse()
松开鼠标按钮。
|
void |
releaseMouse(int button)
松开鼠标按钮。
|
void |
releaseMouse(int button,
Point pos)
松开鼠标按钮。
|
void |
releaseMouse(int button,
Point pos,
ModifierKey modifiers)
松开鼠标按钮。
|
void |
sendKeys(String keys)
发送键。
|
void |
setFocus()
为控件分配焦点。
|
void |
synchSendKeys(String keys)
同步发送键。
|
void |
synchSendKeys(String keys,
int screenUpdateWaitCount)
同步发送键。
|
void |
synchSendKeys(String keys,
int screenUpdateWaitCount,
int timeout)
同步发送键。
|
void |
typeKeys(String keys)
发送一组按键至对象。
|
void |
typeKeys(String keys,
int delay)
发送一组按键至对象。
|
void |
typeKeys(String keys,
int delay,
boolean ensureFocus)
发送一组按键至对象。
|
void |
typePasswordKeys(String keys)
将加密的密码输入对象,例如文本字段。
|
void |
typePasswordKeys(String keys,
int delay)
将加密的密码输入对象,例如文本字段。
|
void |
typePasswordKeys(String keys,
int delay,
boolean ensureFocus)
将加密的密码输入对象,例如文本字段。
|
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 RumbaObject(JtfObjectHandle handle, Desktop desktop)
handle
- 可确定 RumbaObject 的句柄desktop
- 此对象所在的桌面public void click()
示例使用情况
例如,要单击控件中的某个位置,请键入以下内容:
control.click (MouseButton.LEFT, new Point(244, 16));
以下示例使用鼠标左键单击控件中心:
control.click ();
click
in interface IClickable
public void click(int button)
示例使用情况
例如,要单击控件中的某个位置,请键入以下内容:
control.click (MouseButton.LEFT, new Point(244, 16));
以下示例使用鼠标左键单击控件中心:
control.click ();
click
in interface IClickable
button
- 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...public void click(int button, Point pos)
示例使用情况
例如,要单击控件中的某个位置,请键入以下内容:
control.click (MouseButton.LEFT, new Point(244, 16));
以下示例使用鼠标左键单击控件中心:
control.click ();
click
in interface IClickable
button
- 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...pos
- 坐标(相对于对象),在此单击public void click(int button, Point pos, ModifierKey modifiers)
示例使用情况
例如,要单击控件中的某个位置,请键入以下内容:
control.click (MouseButton.LEFT, new Point(244, 16));
以下示例使用鼠标左键单击控件中心:
control.click ();
click
in interface IClickable
button
- 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...pos
- 坐标(相对于对象),在此单击modifiers
- 修饰符public void doubleClick()
doubleClick
in interface IClickable
public void doubleClick(int button)
doubleClick
in interface IClickable
button
- 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...public void doubleClick(int button, Point pos)
doubleClick
in interface IClickable
button
- 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...pos
- 坐标(相对于对象),在此单击public void doubleClick(int button, Point pos, ModifierKey modifiers)
doubleClick
in interface IClickable
button
- 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...pos
- 坐标(相对于对象),在此单击modifiers
- 修饰符public boolean isFocused()
isFocused
in interface IFocusable
public void mouseMove()
mouseMove
in interface IClickable
public void mouseMove(Point pos)
mouseMove
in interface IClickable
pos
- 新位置坐标(相对于窗口)public void pressKeys(String keys)
有效按键包括:
public void pressKeys(String keys, boolean ensureFocus)
有效按键包括:
public void pressMouse()
pressMouse
in interface IClickable
public void pressMouse(int button)
pressMouse
in interface IClickable
button
- 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...public void pressMouse(int button, Point pos)
pressMouse
in interface IClickable
button
- 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...pos
- 坐标(相对于对象),在此点按鼠标public void pressMouse(int button, Point pos, ModifierKey modifiers)
pressMouse
in interface IClickable
button
- 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...pos
- 坐标(相对于对象),在此点按鼠标modifiers
- 修饰符public void releaseKeys(String keys)
有效按键包括:
releaseKeys
in interface IKeyable
keys
- 可松开的键或鼠标按钮public void releaseKeys(String keys, boolean ensureFocus)
有效按键包括:
releaseKeys
in interface IKeyable
keys
- 可松开的键或鼠标按钮ensureFocus
- 确定控件是否一定具有按键焦点。默认为 true
public void releaseMouse()
releaseMouse
in interface IClickable
public void releaseMouse(int button)
releaseMouse
in interface IClickable
button
- 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...public void releaseMouse(int button, Point pos)
releaseMouse
in interface IClickable
button
- 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...pos
- 坐标(相对于对象),在此松开鼠标public void releaseMouse(int button, Point pos, ModifierKey modifiers)
releaseMouse
in interface IClickable
button
- 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...pos
- 坐标(相对于对象),在此松开鼠标modifiers
- 修饰符public void sendKeys(String keys)
示例使用情况行
相当于rumbaScreen.sendKeys (RumbaKey.TAB );
RumbaKey 常数可与以下常规字符串组合:rumbaScreen.sendKeys ("@T");
有关所有可用常数,请参见类 RumbaKey。rumbaScreen.sendKeys ("someone" +RumbaKey.AT + "example.com");
keys
- 可发送的键。此字符串中可使用 Rumba 键盘助记符。有关 Rumba 键盘助记符的更多信息,请参阅 RDE .NET 帮助。public void setFocus()
setFocus
in interface IFocusable
public void synchSendKeys(String keys)
示例使用情况行
相当于rumbaScreen.synchSendKeys (RumbaKey.PF3 );
RumbaKey 常数可与以下常规字符串组合:rumbaScreen.synchSendKeys ("@3");
有关所有可用常数,请参见类 RumbaKey。rumbaScreen.synchSendKeys ("someone" +RumbaKey.AT + "example.com" +RumbaKey.ENTER );
keys
- 可发送的键。此字符串中可使用 Rumba 键盘助记符。有关 Rumba 键盘助记符的更多信息,请参阅 RDE .NET 帮助。public void synchSendKeys(String keys, int screenUpdateWaitCount)
示例使用情况行
相当于rumbaScreen.synchSendKeys (RumbaKey.PF3 );
RumbaKey 常数可与以下常规字符串组合:rumbaScreen.synchSendKeys ("@3");
有关所有可用常数,请参见类 RumbaKey。rumbaScreen.synchSendKeys ("someone" +RumbaKey.AT + "example.com" +RumbaKey.ENTER );
keys
- 可发送的键。此字符串中可使用 Rumba 键盘助记符。有关 Rumba 键盘助记符的更多信息,请参阅 RDE .NET 帮助。screenUpdateWaitCount
- 屏幕准备好进一步交互前需等待的屏幕更新的数量public void synchSendKeys(String keys, int screenUpdateWaitCount, int timeout)
示例使用情况行
相当于rumbaScreen.synchSendKeys (RumbaKey.PF3 );
RumbaKey 常数可与以下常规字符串组合:rumbaScreen.synchSendKeys ("@3");
有关所有可用常数,请参见类 RumbaKey。rumbaScreen.synchSendKeys ("someone" +RumbaKey.AT + "example.com" +RumbaKey.ENTER );
keys
- 可发送的键。此字符串中可使用 Rumba 键盘助记符。有关 Rumba 键盘助记符的更多信息,请参阅 RDE .NET 帮助。screenUpdateWaitCount
- 屏幕准备好进一步交互前需等待的屏幕更新的数量timeout
- 以毫秒为单位的超时。如果设置为 0,则使用 Rumba API 的默认超时(当前为 10000ms)。public void typeKeys(String keys)
有效按键包括:
示例使用情况例如,以下代码通过按 Ctrl+C 复制当前所选文本至剪贴板:
window.typeKeys ("<Left Ctrl+C>");
public void typeKeys(String keys, int delay)
有效按键包括:
示例使用情况例如,以下代码通过按 Ctrl+C 复制当前所选文本至剪贴板:
window.typeKeys ("<Left Ctrl+C>");
public void typeKeys(String keys, int delay, boolean ensureFocus)
有效按键包括:
示例使用情况例如,以下代码通过按 Ctrl+C 复制当前所选文本至剪贴板:
window.typeKeys ("<Left Ctrl+C>");
public void typePasswordKeys(String keys)
如果对象支持 SetText 方法,那么在输入加密的密码前,任何现有文本都将清空。
示例使用情况
示例用法
例如,以下代码对字符串加密并将其打印到控制台:
String encryptedPassword = desktop.encrypt("my password"); System.out.println(encryptedPassword);
然后,您可以从控制台中复制加密的密码,在这种情况下是 6Fk+Bcm+GoXe3X0=
,并按照如下所示的方式使用:
textField.typePasswordKeys("6Fk+Bcm+GoXe3X0=");
typePasswordKeys
in interface IKeyable
keys
- 加密密码public void typePasswordKeys(String keys, int delay)
如果对象支持 SetText 方法,那么在输入加密的密码前,任何现有文本都将清空。
示例使用情况
示例用法
例如,以下代码对字符串加密并将其打印到控制台:
String encryptedPassword = desktop.encrypt("my password"); System.out.println(encryptedPassword);
然后,您可以从控制台中复制加密的密码,在这种情况下是 6Fk+Bcm+GoXe3X0=
,并按照如下所示的方式使用:
textField.typePasswordKeys("6Fk+Bcm+GoXe3X0=");
typePasswordKeys
in interface IKeyable
keys
- 加密密码delay
- 按键之间延迟时间(毫秒)public void typePasswordKeys(String keys, int delay, boolean ensureFocus)
如果对象支持 SetText 方法,那么在输入加密的密码前,任何现有文本都将清空。
示例使用情况
示例用法
例如,以下代码对字符串加密并将其打印到控制台:
String encryptedPassword = desktop.encrypt("my password"); System.out.println(encryptedPassword);
然后,您可以从控制台中复制加密的密码,在这种情况下是 6Fk+Bcm+GoXe3X0=
,并按照如下所示的方式使用:
textField.typePasswordKeys("6Fk+Bcm+GoXe3X0=");
typePasswordKeys
in interface IKeyable
keys
- 加密密码delay
- 按键之间延迟时间(毫秒)ensureFocus
- 确定控件是否一定具有按键焦点。默认为 true
Copyright 2009-2012 Micro Focus. All Rights Reserved.