Documentation
¶
Index ¶
- type Instance
- func (ins *Instance) GetPhysicalSize() (width int, height int, err error)
- func (ins *Instance) LongPress(x, y int, duration int) error
- func (ins *Instance) LongPressLikeAHumanBeing(x, y int, duration int, axisOffset, timeOffset int) error
- func (ins *Instance) Screenshot(targetPath string) error
- func (ins *Instance) Swipe(x1, y1, x2, y2 int, duration int) error
- func (ins *Instance) SwipeLikeAHumanBeing(x1, y1, x2, y2 int, duration int, axisOffset, timeOffset int) error
- func (ins *Instance) Tap(x, y int) error
- func (ins *Instance) TapLikeAHumanBeing(x, y int, axisOffset int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Instance ¶
type Instance struct {
/*
截图的锁,防止并发冲突.
PS: 截图频率不要太高,建议至少要间隔500~1000ms。
*/
sync.Mutex
// contains filtered or unexported fields
}
func (*Instance) GetPhysicalSize ¶
GetPhysicalSize 获取:分辨率(宽高、尺寸).
func (*Instance) LongPress ¶
LongPress 长按.
命令:adb -s 127.0.0.1:5555 shell input swipe 500 1000 500 1000 2000 @param duration: 持续时间(单位:ms)
func (*Instance) LongPressLikeAHumanBeing ¶
func (ins *Instance) LongPressLikeAHumanBeing(x, y int, duration int, axisOffset, timeOffset int) error
LongPressLikeAHumanBeing
@param duration 持续时间(单位:ms) @param timeOffset 持续时间的偏移量(单位:ms)
func (*Instance) Swipe ¶
Swipe 滑动.
命令:adb -s 127.0.0.1:5555 shell input swipe <x1> <y1> <x2> <y2> <duration> @param x1, y1: 起始坐标 @param x2, y2: 结束坐标 @param duration: 持续时间(单位:ms) e.g. 向上滑动(上滑刷新/滚动) adb -s 127.0.0.1:5555 shell input swipe 500 1500 500 500 300 e.g.1 向下滑动(下拉通知栏) adb -s 127.0.0.1:5555 shell input swipe 500 100 500 1000 300 e.g.2 向左滑动 adb -s 127.0.0.1:5555 shell input swipe 900 500 100 500 300 e.g.3 向右滑动 adb -s 127.0.0.1:5555 shell input swipe 100 500 900 500 300
func (*Instance) SwipeLikeAHumanBeing ¶
func (ins *Instance) SwipeLikeAHumanBeing(x1, y1, x2, y2 int, duration int, axisOffset, timeOffset int) error
SwipeLikeAHumanBeing 像人一样滑动(每次的位置和时间都不一样).
@param duration 持续时间(单位:ms) @param timeOffset 持续时间的偏移量(单位:ms)
Click to show internal directories.
Click to hide internal directories.