public class WPFBase extends TestObject implements IFocusable, IClickable, IKeyable
| Modifier | Constructor and Description |
|---|---|
protected |
WPFBase(JtfObjectHandle handle,
Desktop desktop)
使用 JtfObjectHandle 创建新 WPFBase。
|
| Modifier and Type | Method and Description |
|---|---|
void |
bringIntoView()
尝试将此元素放到视图上。
|
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)
双击对象上的鼠标按钮。
|
String |
getToolTip()
获取 针对用户界面 (UI) 中的此元素显示的工具提示。
|
boolean |
isEnabled()
获取 表示用户界面 (UI) 中的此元素是否已启用的值。
|
boolean |
isFocused()
返回控件是否有焦点。
|
void |
mouseMove()
将指针移至对象中的指定位置。
|
void |
mouseMove(Point pos)
将指针移至对象中的指定位置。
|
void |
openContextMenu()
打开指定位置上的上下文菜单。
|
void |
openContextMenu(Point pos)
打开指定位置上的上下文菜单。
|
void |
openContextMenuSelect(ItemPath item)
打开上下文菜单并选择其中的菜单项目。
|
void |
openContextMenuSelect(ItemPath item,
Point pos)
打开上下文菜单并选择其中的菜单项目。
|
void |
openContextMenuSelect(String item)
打开上下文菜单并选择其中的菜单项目。
|
void |
openContextMenuSelect(String item,
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 WPFBase(JtfObjectHandle handle, Desktop desktop)
handle - 可确定 WPFBase 的句柄desktop - 此对象所在的桌面public void bringIntoView()
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 boolean isFocused()
isFocused in interface IFocusablepublic void mouseMove()
mouseMove in interface IClickablepublic void mouseMove(Point pos)
mouseMove in interface IClickablepos - 新位置坐标(相对于窗口)public void openContextMenu()
public void openContextMenu(Point pos)
pos - 用于打开上下文菜单的坐标应与调用此功能所用的元素相对应public void openContextMenuSelect(ItemPath item)
item - 可选择的菜单项目。可以是顶层菜单项目或可在子菜单中找到的项目。要选择子菜单中的菜单项目,请使用斜线分隔菜单项目名称。项目可包含通配符“?”(匹配一个字符)或“*”(匹配 0 至多个字符)。public void openContextMenuSelect(ItemPath item, Point pos)
item - 可选择的菜单项目。可以是顶层菜单项目或可在子菜单中找到的项目。要选择子菜单中的菜单项目,请使用斜线分隔菜单项目名称。项目可包含通配符“?”(匹配一个字符)或“*”(匹配 0 至多个字符)。pos - 用于打开上下文菜单的坐标应与调用此功能所用的元素相对应public void openContextMenuSelect(String item)
item - 可选择的菜单项目。可以是顶层菜单项目或可在子菜单中找到的项目。要选择子菜单中的菜单项目,请使用斜线分隔菜单项目名称。项目可包含通配符“?”(匹配一个字符)或“*”(匹配 0 至多个字符)。. E.g: /Games/Applications[2]/[0]有关详细信息,请参见 ItemPath.ItemPath(String)。
public void openContextMenuSelect(String item, Point pos)
item - 可选择的菜单项目。可以是顶层菜单项目或可在子菜单中找到的项目。要选择子菜单中的菜单项目,请使用斜线分隔菜单项目名称。项目可包含通配符“?”(匹配一个字符)或“*”(匹配 0 至多个字符)。. E.g: /Games/Applications[2]/[0]有关详细信息,请参见 ItemPath.ItemPath(String)。
pos - 用于打开上下文菜单的坐标应与调用此功能所用的元素相对应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()
setFocus in interface IFocusablepublic 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 isEnabled()
Copyright 2009-2012 Micro Focus. All Rights Reserved.