Chào Kteam,
Mình có học theo Adb tool nhưng sử dụng ngôn ngữ Python, mình chưa hiểu lắm về luồng trong Python, nhờ Kteam chỉ giúp mình về vấn đề này với. Mình muốn sử dụng multithreading để chạy cùng lúc nhiều thiết bị.
from ppadb.client import Client as AdbClient
import time
from python_imagesearch.imagesearch import imagesearch
def getDevice():
client = AdbClient(host="127.0.0.1", port=5037)
devices = client.devices()
if (len(devices) < 0):
print("0 device")
return 0
return devices[1]
device = getDevice()
def postFacebook():
device.input_keyevent(3)
time.sleep(1)
device.input_tap(398, 168)
time.sleep(5)
device.input_tap(1197, 41)
time.sleep(5)
device.input_text("facebook")
device.input_keyevent(66)
time.sleep(2)
pos = imagesearch("facebooklogo.png")
if pos[0] != -1:
print("position : ", pos[0], pos[1])
device.input_tap(pos[0], pos[1])
time.sleep(2)
device.input_tap(1462, 173)
time.sleep(5)
device.input_tap(1333, 219)
else:
print("image not found")
device.input_tap(1462, 173)
time.sleep(5)
device.input_tap(1333, 219)
postFacebook()
Xin cảm ơn!
bạn tham khảo nha
URL