public class BrowserObject extends TestObject implements IClickable, IKeyable
| Modifier | Constructor and Description |
|---|---|
protected |
BrowserObject(JtfObjectHandle handle,
Desktop desktop)
使用 JtfObjectHandle 创建新 BrowserObject。
|
| 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 |
isVisible()
获取 对象是否可见。
|
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 |
setFocus()
为控件分配焦点。
|
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, waitForPropertyequals, 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, toStringprotected BrowserObject(JtfObjectHandle handle, Desktop desktop)
handle - 可确定 BrowserObject 的句柄desktop - 此对象所在的桌面public void click()
示例使用情况
例如,要单击控件中的某个位置,请键入以下内容:
control.click (MouseButton.LEFT, new Point(244, 16));
以下示例使用鼠标左键单击控件中心:
control.click ();
click in interface IClickablepublic void click(int button)
示例使用情况
例如,要单击控件中的某个位置,请键入以下内容:
control.click (MouseButton.LEFT, new Point(244, 16));
以下示例使用鼠标左键单击控件中心:
control.click ();
click in interface IClickablebutton - 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...public void click(int button,
Point pos)
示例使用情况
例如,要单击控件中的某个位置,请键入以下内容:
control.click (MouseButton.LEFT, new Point(244, 16));
以下示例使用鼠标左键单击控件中心:
control.click ();
click in interface IClickablebutton - 可点按的鼠标按钮。值包括: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 IClickablebutton - 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...pos - 坐标(相对于对象),在此单击modifiers - 修饰符public void doubleClick()
doubleClick in interface IClickablepublic void doubleClick(int button)
doubleClick in interface IClickablebutton - 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...public void doubleClick(int button,
Point pos)
doubleClick in interface IClickablebutton - 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...pos - 坐标(相对于对象),在此单击public void doubleClick(int button,
Point pos,
ModifierKey modifiers)
doubleClick in interface IClickablebutton - 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...pos - 坐标(相对于对象),在此单击modifiers - 修饰符public void mouseMove()
mouseMove in interface IClickablepublic void mouseMove(Point pos)
mouseMove in interface IClickablepos - 新位置坐标(相对于窗口)public void pressKeys(String keys)
有效按键包括:
public void pressKeys(String keys, boolean ensureFocus)
有效按键包括:
public void pressMouse()
pressMouse in interface IClickablepublic void pressMouse(int button)
pressMouse in interface IClickablebutton - 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...public void pressMouse(int button,
Point pos)
pressMouse in interface IClickablebutton - 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...pos - 坐标(相对于对象),在此点按鼠标public void pressMouse(int button,
Point pos,
ModifierKey modifiers)
pressMouse in interface IClickablebutton - 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...pos - 坐标(相对于对象),在此点按鼠标modifiers - 修饰符public void releaseKeys(String keys)
有效按键包括:
releaseKeys in interface IKeyablekeys - 可松开的键或鼠标按钮public void releaseKeys(String keys, boolean ensureFocus)
有效按键包括:
releaseKeys in interface IKeyablekeys - 可松开的键或鼠标按钮ensureFocus - 确定控件是否一定具有按键焦点。默认为 truepublic void releaseMouse()
releaseMouse in interface IClickablepublic void releaseMouse(int button)
releaseMouse in interface IClickablebutton - 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...public void releaseMouse(int button,
Point pos)
releaseMouse in interface IClickablebutton - 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...pos - 坐标(相对于对象),在此松开鼠标public void releaseMouse(int button,
Point pos,
ModifierKey modifiers)
releaseMouse in interface IClickablebutton - 可点按的鼠标按钮。值包括:1= 左键,2= 右键,3= 中键...pos - 坐标(相对于对象),在此松开鼠标modifiers - 修饰符public void setFocus()
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 IKeyablekeys - 加密密码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 IKeyablekeys - 加密密码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 IKeyablekeys - 加密密码delay - 按键之间延迟时间(毫秒)ensureFocus - 确定控件是否一定具有按键焦点。默认为 truepublic boolean isVisible()
是。然而在回放时,已定位的对象变得不可见时你可能还是需要此属性。Copyright 2009-2012 Micro Focus. All Rights Reserved.