def click_picture(screen_picture, current_picture, thing): global c global s c = wda.Client() s = c.session() p1 = screen_picture p2 = current_picture print(s.window_size()) print(p1) print(p2) a, x, y = opencv.imgcompare(p1, p2) k = 0 while not a: c.screenshot(screen_picture) p1 = screen_picture p2 = current_picture a, x, y = opencv.imgcompare(p1, p2) k = k + 1 # 隔二秒再截图 sleep(2) print('截图 尝试第', k, '次', thing) if k == 10: return False if a: print('获取点击坐标', thing, a, x, y) s().wait(1.0) #p.touch(s, x, y) s.tap(x, y) return True
def click_picture(screen_picture, current_picture, thing): global c global s c = wda.Client() s = c.session() p1 = screen_picture p2 = current_picture a, x, y = opencv.imgcompare(p1, p2) k = 0 while not a: c.screenshot(screen_picture) p1 = screen_picture p2 = current_picture a, x, y = opencv.imgcompare(p1, p2) k = k + 1 print('尝试第', k, '次', thing) if k == 3: sleep(2) return False if a: print('截图 获取点击坐标', thing, a, x, y) x = x + 150 p.touch(s, x, y) s.tap(x, y) print(x, y) return True
def click_picture(screen_picture, current_picture, thing): p1 = screen_picture p2 = current_picture print(s.window_size()) print(p1) print(p2) a, x, y = opencv.imgcompare(p1, p2) k = 0 while not a: c.screenshot(screen_picture) p1 = screen_picture p2 = current_picture a, x, y = opencv.imgcompare(p1, p2) k = k + 1 # 隔一秒再截图 sleep(1) print('截图 尝试第', k, '次', thing) if k == 3: return False if a: print('click获取点击坐标', thing, a, x, y) s().wait(1.0) #p.touch(s, x, y) s.tap(x, y) return True
def installing(): global install_flag if install_need == 0: report("", "", "安装不需要同意") return device_not = "df22ca99,SSHUQOC6SCZLVS8L" if device_not.find(device) > -1: return path = "/home/work/yuntest/before_install_pic" if os.path.exists(path + "/" + device0): path = path + "/" + device0 print(path) report("", "install pic路径变更", path) fileList = [] files = os.listdir(path) for f in files: if os.path.isfile(path + '/' + f) and (f.find(".jpeg") > 0 or f.find(".jpg")) > 0: fileList.append(path + '/' + f) sleep(1) while install_flag > 0: install_flag = install_flag - 1 pic = adb_shot() for f in fileList: a, x, y = opencv.imgcompare(pic, f) #print(a) if a: adbtouch(x, y) #break print("安装检查退出") return
def find_picture(screen_picture, current_picture, thing): p1 = screen_picture p2 = current_picture a, x, y = opencv.imgcompare(p1, p2) k = 0 while not a: c.screenshot(screen_picture) p1 = screen_picture p2 = current_picture a, x, y = opencv.imgcompare(p1, p2) k = k + 1 # 隔二秒再截图 sleep(2) print('尝试第', k, '次', thing) if k == 10: return False if a: print('获取点击坐标', thing, a, x, y) return True
def find_picture1(screen_picture, current_picture, thing): p1 = screen_picture p2 = current_picture print(s.window_size()) print(p1) print(p2) a, x, y = opencv.imgcompare(p1, p2) k = 0 while not a: c.screenshot(screen_picture) p1 = screen_picture p2 = current_picture a, x, y = opencv.imgcompare(p1, p2) k = k + 1 # 隔15秒再截图 sleep(15) print('找图1 尝试第', k, '次', thing) if k == 4: return False if a: print('find获取点击坐标', thing, a, x, y) return True
def find_picture(screen_picture, current_picture, thing): global c global s c = wda.Client() s = c.session() p1 = screen_picture p2 = current_picture a, x, y = opencv.imgcompare(p1, p2) k = 0 while not a: c.screenshot(screen_picture) p1 = screen_picture p2 = current_picture a, x, y = opencv.imgcompare(p1, p2) k = k + 1 # 隔二秒再截图 sleep(2) print('尝试第', k, '次', thing) if k == 4: return False if a: print('找图 获取点击坐标', thing, a, x, y) return True