public class SLBase extends TestObject implements IFocusable, IClickable, IKeyable
Modifier | Constructor and Description |
---|---|
protected |
SLBase(JtfObjectHandle handle,
Desktop desktop)
使用 JtfObjectHandle 创建新 SLBase。
|
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)
双击对象上的鼠标按钮。
|
String |
getAutomationId()
获取 包含元素的 UI 自动化标识符 (ID) 的字符串。
|
String |
getClassName()
获取 元素的简单类名称。
|
String |
getName()
获取 包含元素的 UI 自动化名称的字符串。
|
List<SLBase> |
getRawChildren()
获取此元素的原始子级元素。
|
List<SLBase> |
getRawChildren(String automationControlType)
获取此元素的原始子级元素。
|
boolean |
isEnabled()
获取 表示元素是否已启用的值。
|
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 |
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, 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 SLBase(JtfObjectHandle handle, Desktop desktop)
handle
- 可确定 SLBase 的句柄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 List<SLBase> getRawChildren()
示例使用情况要获取元素的所有原始子级:
slBase.GetRawChildren()要仅获取某个控件类型的子级。有关控件类型列表,请查看 MSUIA 提供的控件类型。
slBase.GetRawChildren("Text")
public List<SLBase> getRawChildren(String automationControlType)
示例使用情况要获取元素的所有原始子级:
slBase.GetRawChildren()要仅获取某个控件类型的子级。有关控件类型列表,请查看 MSUIA 提供的控件类型。
slBase.GetRawChildren("Text")
automationControlType
- 还可指定仅可以检索具有此控件类型的子级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 setFocus()
setFocus
in interface IFocusable
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
public String getAutomationId()
public String getClassName()
public boolean isEnabled()
public String getName()
Copyright 2009-2012 Micro Focus. All Rights Reserved.