Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何自动化adb事件_Adb_Keyevent - Fatal编程技术网

如何自动化adb事件

如何自动化adb事件,adb,keyevent,Adb,Keyevent,我使用了各种adb shell命令,通过adb将URL自动加载到手机。它会加载页面,但我需要在屏幕上选择一个图像。我尝试过adb shell input keyevents,但有时会丢失图像,因此我需要使用send事件并模拟触摸屏幕 有人能帮忙吗。我如何找出这张照片的坐标 谢谢您可以使用它获取屏幕截图 import sys import os from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice device = Monk

我使用了各种adb shell命令,通过adb将URL自动加载到手机。它会加载页面,但我需要在屏幕上选择一个图像。我尝试过adb shell input keyevents,但有时会丢失图像,因此我需要使用send事件并模拟触摸屏幕

有人能帮忙吗。我如何找出这张照片的坐标

谢谢

您可以使用它获取屏幕截图

import sys
import os
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
device = MonkeyRunner.waitForConnection(10 , os.getenv('ANDROID_SERIAL'));
image = device.takeSnapshot();
image.writeToFile("/folder/test.png","png");
不要忘记在windows上设置,在Linux上导出
ANDROID\u SERIAL
-这是您的设备号(可以使用
adb设备


然后在
绘图
或任何其他工具中打开图像,获取图片的坐标

从开发者选项中启用
显示指针位置
。它将显示您触摸的点的坐标。使用坐标,您可以使用monkeyrunner或

adb shell input tap <x><y>
adb外壳输入抽头