本文整理汇总了Python中uiautomator.Device.wait方法的典型用法代码示例。如果您正苦于以下问题:Python Device.wait方法的具体用法?Python Device.wait怎么用?Python Device.wait使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uiautomator.Device
的用法示例。
在下文中一共展示了Device.wait方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: UiTestLib
# 需要导入模块: from uiautomator import Device [as 别名]
# 或者: from uiautomator.Device import wait [as 别名]
class UiTestLib(object):
"""Ui Test Lib
"""
def __init__(self, serial=None):
"""
"""
logger.info("<p>Device=%s>" % serial, html=True)
print "<p>Device=%s>" % serial
self._result = ""
self.starttime = 0
self.d = Device(serial)
self.adb = Adb(serial)
self.debug = "True"
def set_debugable(flag):
self.debug = flag
def set_serial(self, serial):
"""Specify given *serial* device to perform test.
or export ANDROID_SERIAL=CXFS42343 if you have many devices connected but you don't use this
interface
When you need to use multiple devices, do not use this keyword to switch between devices in test execution.
And set the serial to each library.
Using different library name when importing this library according to
http://robotframework.googlecode.com/hg/doc/userguide/RobotFrameworkUserGuide.html?r=2.8.5.
Examples:
| Setting | Value | Value | Value |
| Library | UiTestLib | WITH NAME | Mobile1 |
| Library | UiTestLib | WITH NAME | Mobile2 |
And set the serial to each library.
| Test Case | Action | Argument |
| Multiple Devices | Mobile1.Set Serial | device_1's serial |
| | Mobile2.Set Serial | device_2's serial |
"""
self.d = Device(serial)
self.adb = Adb(serial)
def logmsg(self, msg):
if self.debug == "True":
print msg
def exe_adb_command(self, cmd):
""" Execute adb *cmd*
Examples:
| Exe Adb Command | shell getprop |
"""
return self.adb.cmd(cmd).wait()
def exe_adb_and_result(self, cmd):
"""Execute adb *cmd* and return lines of the command"""
lproc = self.adb.cmd(cmd)
lproc.poll()
lines = lproc.stdout.readlines()
return lines
def get_device_info(self):
"""Get Device information
return info dictionary
"""
return self.d.info
def light_screen(self):
"""Light screen by wakeup.
Examples:
| Action |
|Light screen|
Use `Light screen` to light screen.
"""
self.d.wakeup()
self._result = self.d.press.home()
def open_application(self, appname):
"""Open application by it name `appname`.
Example:
| Action | Argument |
| Open application | "com.android.settings/com.android.settings.Settings" |
"""
appname = "shell am start -n " + appname
print "Open Application:", appname
self._result = self.exe_adb_command(appname)
def click_text(self, text, instance=0):
"""Click text label on screen
instance=0 is default, change when you needed.
Example:
| Action | Argument | Argument |
| Click Text | text | instance |
"""
return self.d(text=text, instance=instance).click.wait()
#.........这里部分代码省略.........