赞
踩
下载adb工具
链接:https://pan.baidu.com/s/1fuobUremdbrs2uQ2Yvo5NQ
提取码:or7m
查看设备
adb devices
测试截图
将截屏文件保存到电脑上
import subprocess
class Screenshot(): # 截取手机屏幕并保存到电脑
def __init__(self):
# 查看连接的手机
connect = subprocess.Popen("adb devices", stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True)
stdout, stderr = connect.communicate() # 获取返回命令
# 输出执行命令结果结果
stdout = stdout.decode("utf-8")
stderr = stderr.decode("utf-8")
print(stdout)
print(stderr)
def screen(self, cmd): # 在手机上截图
screenExecute = subprocess.Popen(str(cmd), stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True)
stdout, stderr = screenExecute.communicate()
# 输出执行命令结果结果
stdout = stdout.decode("utf-8")
stderr = stderr.decode("utf-8")
print(stdout)
print(stderr)
def saveComputer(self, cmd): # 将截图保存到电脑
screenExecute = subprocess.Popen(s
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。