public class MobileDevice extends TestObject implements IMobileGestures, IMobileClickable, IMobileKeyable
Modifier | Constructor and Description |
---|---|
protected |
MobileDevice(JtfObjectHandle handle,
Desktop desktop)
使用 JtfObjectHandle 创建新 MobileDevice。
|
Modifier and Type | Method and Description |
---|---|
void |
click()
单击指定坐标上的设备。
|
void |
click(Point position)
单击指定坐标上的设备。
|
void |
closeApp()
关闭应用程序并发布设备,使其对其他用户可用。
|
void |
drag(Point start,
Point end)
在两个指定点间执行拖动操作。
|
String |
generateConnectionString()
Generates a connection string for this mobile device.。
|
String |
getDeviceId()
获取 当前连接设备的 id。
|
int |
getDisplayHeight()
获取 显示高度(像素)。
|
DisplayOrientation |
getDisplayOrientation()
获取 设备的当前方向。
|
int |
getDisplayWidth()
获取 显示宽度(像素)。
|
String |
getModel()
获取 The device name of the connected device.。
|
MobileOperatingSystem |
getOperatingSystem()
获取 the operating system of the mobile device, Android or iOS。
|
String |
getOsVersion()
获取 已连接设备的操作系统的版本。
|
boolean |
isEmulator()
获取 已连接设备是否是仿真器。
|
void |
longClick()
多次单击指定坐标上的设备。
|
void |
longClick(Point position)
多次单击指定坐标上的设备。
|
void |
multiTouch(List<List<Point>> pointers)
使用指定指针执行多点触控操作。
|
void |
pinchIn()
执行两点手势,每个指针都朝另一个指针移动(从对象的边缘到中心)。
|
void |
pinchIn(int percent)
执行两点手势,每个指针都朝另一个指针移动(从对象的边缘到中心)。
|
void |
pinchOut()
执行两点手势,每个指针都朝与另一个指针相反的方向移动(从对象的中心到边缘)。
|
void |
pinchOut(int percent)
执行两点手势,每个指针都朝与另一个指针相反的方向移动(从对象的中心到边缘)。
|
void |
pressBack()
按“返回”按钮。
|
void |
pressDelete()
按“删除”按钮。
|
void |
pressEnter()
按 Enter 键。
|
void |
pressHome()
按“主页”按钮。
|
void |
pressKeyCode(int keyCode)
Presses a certain Android-specific key code.
|
void |
pressRecentApps()
按“最新应用程序”按钮。
|
void |
rotate(DisplayOrientation orientation)
模拟旋转设备屏幕。
|
void |
setLocation(double latitude,
double longitude)
Sets the geographic location of the device, this method only works on Android devices (physical or emulated) and iOS simulators.。
|
void |
sleep()
如果屏幕打开,则按电源按钮。
|
void |
swipe(Point start,
Point end)
在两个指定点间执行滑动。
|
void |
swipe(Point start,
Point end,
int steps)
在两个指定点间执行滑动。
|
void |
swipe(Point start,
Point end,
int steps,
int delayBetweenSteps)
在两个指定点间执行滑动。
|
void |
swipeDown()
执行向下滑动。
|
void |
swipeDown(int steps)
执行向下滑动。
|
void |
swipeDown(int steps,
int delayBetweenSteps)
执行向下滑动。
|
void |
swipeLeft()
执行向左滑动。
|
void |
swipeLeft(int steps)
执行向左滑动。
|
void |
swipeLeft(int steps,
int delayBetweenSteps)
执行向左滑动。
|
void |
swipeRight()
执行向右滑动。
|
void |
swipeRight(int steps)
执行向右滑动。
|
void |
swipeRight(int steps,
int delayBetweenSteps)
执行向右滑动。
|
void |
swipeUp()
执行向上滑动。
|
void |
swipeUp(int steps)
执行向上滑动。
|
void |
swipeUp(int steps,
int delayBetweenSteps)
执行向上滑动。
|
void |
swipeWithSegments(List<Point> segments)
在两点间执行滑动。
|
void |
swipeWithSegments(List<Point> segments,
int steps)
在两点间执行滑动。
|
void |
swipeWithSegments(List<Point> segments,
int steps,
int delayBetweenSteps)
在两点间执行滑动。
|
void |
twoPointerMultiTouch(Point startPointer1,
Point endPointer1,
Point startPointer2,
Point endPointer2)
使用两个指针执行多点触控操作。
|
void |
twoPointerMultiTouch(Point startPointer1,
Point endPointer1,
Point startPointer2,
Point endPointer2,
int steps)
使用两个指针执行多点触控操作。
|
void |
twoPointerMultiTouch(Point startPointer1,
Point endPointer1,
Point startPointer2,
Point endPointer2,
int steps,
int delayBetweenSteps)
使用两个指针执行多点触控操作。
|
void |
typeKeys(String keys)
发送一组按键至对象。
|
void |
typeKeys(String keys,
int delay)
发送一组按键至对象。
|
void |
typeKeys(String keys,
int delay,
boolean ensureFocus)
发送一组按键至对象。
|
void |
wakeUp()
如果屏幕关闭,则按电源按钮。
|
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 MobileDevice(JtfObjectHandle handle, Desktop desktop)
handle
- 可确定 MobileDevice 的句柄desktop
- 此对象所在的桌面public void click()
click
in interface IMobileClickable
public void click(Point position)
click
in interface IMobileClickable
position
- 可单击的坐标public void closeApp()
public void drag(Point start, Point end)
drag
in interface IMobileGestures
start
- 第一个拖动操的起点end
- 第一个拖动操的终点public String generateConnectionString()
public void longClick()
longClick
in interface IMobileClickable
public void longClick(Point position)
longClick
in interface IMobileClickable
position
- 可多次单击的坐标public void multiTouch(List<List<Point>> pointers)
multiTouch
in interface IMobileGestures
pointers
- 指针的列表,其中每个指针包含描述其触控路径的点列表public void pinchIn()
pinchIn
in interface IMobileGestures
public void pinchIn(int percent)
pinchIn
in interface IMobileGestures
percent
- 收缩手势的对象对角线长度的百分比public void pinchOut()
pinchOut
in interface IMobileGestures
public void pinchOut(int percent)
pinchOut
in interface IMobileGestures
percent
- 收缩手势的对象对角线长度的百分比public void pressBack()
public void pressDelete()
public void pressEnter()
public void pressHome()
public void pressKeyCode(int keyCode)
有关受支持的 Android 键代码的更多信息,请参考 Appium 文档。
keyCode
- 可按的所需键代码public void pressRecentApps()
public void rotate(DisplayOrientation orientation)
orientation
- the desired device screen orientationpublic void setLocation(double latitude, double longitude)
latitude
- Latitude of the location in degrees and minutes represented as a double value.longitude
- Longitude of the location in degrees and minutes represented as a double value.public void sleep()
public void swipe(Point start, Point end)
swipe
in interface IMobileGestures
start
- 滑动的开始位置end
- 滑动的结束位置public void swipe(Point start, Point end, int steps)
swipe
in interface IMobileGestures
start
- 滑动的开始位置end
- 滑动的结束位置steps
- 指定点间的步骤的数量。增加步骤的数量以增加滑动的持续时间。public void swipe(Point start, Point end, int steps, int delayBetweenSteps)
swipe
in interface IMobileGestures
start
- 滑动的开始位置end
- 滑动的结束位置steps
- 指定点间的步骤的数量。增加步骤的数量以增加滑动的持续时间。delayBetweenSteps
- public void swipeDown()
swipeDown
in interface IMobileGestures
public void swipeDown(int steps)
swipeDown
in interface IMobileGestures
steps
- 滑动的步骤的数量。增加步骤的数量以增加滑动的持续时间。public void swipeDown(int steps, int delayBetweenSteps)
swipeDown
in interface IMobileGestures
steps
- 滑动的步骤的数量。增加步骤的数量以增加滑动的持续时间。delayBetweenSteps
- public void swipeLeft()
swipeLeft
in interface IMobileGestures
public void swipeLeft(int steps)
swipeLeft
in interface IMobileGestures
steps
- 滑动的步骤的数量。增加步骤的数量以增加滑动的持续时间。public void swipeLeft(int steps, int delayBetweenSteps)
swipeLeft
in interface IMobileGestures
steps
- 滑动的步骤的数量。增加步骤的数量以增加滑动的持续时间。delayBetweenSteps
- public void swipeRight()
swipeRight
in interface IMobileGestures
public void swipeRight(int steps)
swipeRight
in interface IMobileGestures
steps
- 滑动的步骤的数量。增加步骤的数量以增加滑动的持续时间。public void swipeRight(int steps, int delayBetweenSteps)
swipeRight
in interface IMobileGestures
steps
- 滑动的步骤的数量。增加步骤的数量以增加滑动的持续时间。delayBetweenSteps
- public void swipeUp()
swipeUp
in interface IMobileGestures
public void swipeUp(int steps)
swipeUp
in interface IMobileGestures
steps
- 滑动的步骤的数量。增加步骤的数量以增加滑动的持续时间。public void swipeUp(int steps, int delayBetweenSteps)
swipeUp
in interface IMobileGestures
steps
- 滑动的步骤的数量。增加步骤的数量以增加滑动的持续时间。delayBetweenSteps
- public void swipeWithSegments(List<Point> segments)
swipeWithSegments
in interface IMobileGestures
segments
- 可滑动的点间距public void swipeWithSegments(List<Point> segments, int steps)
swipeWithSegments
in interface IMobileGestures
segments
- 可滑动的点间距steps
- 滑动的步骤的数量。增加步骤的数量以增加滑动的持续时间。public void swipeWithSegments(List<Point> segments, int steps, int delayBetweenSteps)
swipeWithSegments
in interface IMobileGestures
segments
- 可滑动的点间距steps
- 滑动的步骤的数量。增加步骤的数量以增加滑动的持续时间。delayBetweenSteps
- public void twoPointerMultiTouch(Point startPointer1, Point endPointer1, Point startPointer2, Point endPointer2)
twoPointerMultiTouch
in interface IMobileGestures
startPointer1
- 第一个指针的开始点endPointer1
- 第一个指针的结束点startPointer2
- 第二个指针的开始点endPointer2
- 第二个指针的结束点public void twoPointerMultiTouch(Point startPointer1, Point endPointer1, Point startPointer2, Point endPointer2, int steps)
twoPointerMultiTouch
in interface IMobileGestures
startPointer1
- 第一个指针的开始点endPointer1
- 第一个指针的结束点startPointer2
- 第二个指针的开始点endPointer2
- 第二个指针的结束点steps
- 指定点间的步骤的数量。增加步骤的数量以增加拖动操作的持续时间。public void twoPointerMultiTouch(Point startPointer1, Point endPointer1, Point startPointer2, Point endPointer2, int steps, int delayBetweenSteps)
twoPointerMultiTouch
in interface IMobileGestures
startPointer1
- 第一个指针的开始点endPointer1
- 第一个指针的结束点startPointer2
- 第二个指针的开始点endPointer2
- 第二个指针的结束点steps
- 指定点间的步骤的数量。增加步骤的数量以增加拖动操作的持续时间。delayBetweenSteps
- public void typeKeys(String keys)
typeKeys
in interface IMobileKeyable
keys
- 可键入的按键public void typeKeys(String keys, int delay)
typeKeys
in interface IMobileKeyable
keys
- 可键入的按键delay
- 按键之间延迟时间(毫秒)public void typeKeys(String keys, int delay, boolean ensureFocus)
typeKeys
in interface IMobileKeyable
keys
- 可键入的按键delay
- 按键之间延迟时间(毫秒)ensureFocus
- 确定是否应确保移动对象具有焦点。通过单击移动对象中间设置焦点。默认为 true
public void wakeUp()
public String getDeviceId()
public int getDisplayHeight()
public DisplayOrientation getDisplayOrientation()
public int getDisplayWidth()
public boolean isEmulator()
public String getModel()
public MobileOperatingSystem getOperatingSystem()
public String getOsVersion()
Copyright 2009-2012 Micro Focus. All Rights Reserved.