自动点击 python 翻倍
sjh pvq4nrx4kzemw4ca zh ['pvq4nrx4kzemw4ca'] lx [] >>> sjjtjc(sjh,"./xmzq.png",0,2) False >>> sjjtjcwzopb(sjh,"./xmksfhzq.png",0,2) False >>> sjjtjc(sjh,"./xmzqa.png",0,2) False >>> sjjtjcwzopb(sjh,"./xmzqa.png",0,2) 723 2139 执行cmd指令="adb -s pvq4nrx4kzemw4ca shell input tap 723 2139" 点了呀 True >>> sjjtjcwzopb(sjh,"./xmfbdj.png",0,2) False >>> sjjtjcwzopab(sjh,"./xmfbdj.png",0,2) Traceback (most recent call last): File "<pyshell#5>", line 1, in <module> sjjtjcwzopab(sjh,"./xmfbdj.png",0,2) File "E:\ADB\0607u\xmks5-xs.py", line 575, in sjjtjcwzopab pos = find_button(target,temp) File "E:\ADB\0607u\xmks5-xs.py", line 356, in find_button result = cv2.matchTemplate(target, template, cv2.TM_SQDIFF_NORMED) cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\templmatch.cpp:1164: error: (-215:Assertion failed) (depth == CV_8U || depth == CV_32F) && type == _templ.type() && _img.dims() <= 2 in function 'cv::matchTemplate' >>> def sjjtjcwzopab(sjh,beitu,jl,xx): #手机利用已经存在的图查找目标并点击 pull_screenshot(2,sjh,xx) # 截图 au='./tmall'+str(xx)+'.png' temp = cv2.imread(au) bz=0 target = cv2.imread(beitu) pos = find_button(target,temp) if pos: print(pos[0],pos[1]) ak="adb -s adudd shell input tap {:d} {:d}".format(pos[0]+jl,pos[1]) ak=ak.replace("adudd",sjh) #print(ak) #time.sleep(2) #process = subprocess.Popen(ak,shell=True) run_cmd(ak) time.sleep(2) print("点了呀") return True else: return False >>> sjjtjcwzopab(sjh,"./xmfbdj.png",0,2) 882 776 执行cmd指令="adb -s pvq4nrx4kzemw4ca shell input tap 882 776" 点了呀 True >>> sjjtjc(sjh,"./xmzq.png",0,2) False >>> sjjtjcwzopb(sjh,"./xmksfhzq.png",0,2) False >>>