如何写在Python脚本来重新启动Android平板多次 [英] How to write script in python to reboot android tablet multiple times

查看:232
本文介绍了如何写在Python脚本来重新启动Android平板多次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能在Python重新启动Android平板电脑并启动任何应用程序多次写剧本。有没有更好的方法来自动完成这个测试。

How can I write script in python to reboot android tablet and launch any app multiple times. Is there any better way to automate this test.

推荐答案

您可以使用命令亚行重启来重新启动设备。

you can use the command adb reboot to reboot a device.

有可能是大量的,你可以使用Python,使这个ADB命令的方式。其中,我能想到的最简单的是:

There are likely a plethora of ways you could use python to make this adb command. The simplest of which that I can think of is:

import os
os.system("adb reboot")

你必须要么把路径盈亚行,从文件夹运行这一点,亚行,或者添加的文件夹,亚行是在你的系统路径变量。

you'll have to either put a path infront of adb, run this from the folder that adb is in, or add the folder that adb is in to your system path variable.

如果你不希望走这条路(或者,如果你想要做一些其他更ineteresting东西亚行)存在的围绕亚行工具,可以让你在一个更Python化的方式进行交互不是简单地运行系统,CMDS Python包装。

If you don't want to go that route (or if you want to do some other more ineteresting things with adb) there exists a python wrapper around the adb tool that will let you interact with it in a more "pythonic" way than simply running system cmds.

这篇关于如何写在Python脚本来重新启动Android平板多次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆