本文整理汇总了Python中uiautomator.Device.long_click方法的典型用法代码示例。如果您正苦于以下问题:Python Device.long_click方法的具体用法?Python Device.long_click怎么用?Python Device.long_click使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uiautomator.Device
的用法示例。
在下文中一共展示了Device.long_click方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ModelInfo
# 需要导入模块: from uiautomator import Device [as 别名]
# 或者: from uiautomator.Device import long_click [as 别名]
#.........这里部分代码省略.........
def pressEnter(self):
return self.mstrDevice.press.enter()
def pressDelete(self):
return self.mstrDevice.press.delete() # or del
def pressRecent(self):
return self.mstrDevice.press.recent()
def pressVol_Up(self):
return self.mstrDevice.press.volume_up()
def pressVol_Down(self):
return self.mstrDevice.press.volume_down()
def pressVol_Mute(self):
return self.mstrDevice.press.volume_mute()
def pressPower(self):
return self.mstrDevice.press.power()
def clik(self, x, y):
return self.mstrDevice.click(x, y)
def longClik(self,x, y):
'''
Description:
param:
x, y : start first point x, y
return : Boolean
'''
return self.mstrDevice.long_click(x, y)
def swipe(self, sx, sy, ex, ey, steps=10):
'''
Description:
param:
sx, xy : start first x, y
ex, ey : move to x, y
return : Boolean
'''
return self.mstrDevice.swipe(sx, sy, ex, ey, steps)
def drage(self,sx, sy, ex, ey, steps=10):
'''
Description:
param:
sx, xy : start first x, y
ex, ey : move to x, y
return : Boolean
'''
return self.mstrDevice.drag(sx, sy, ex, ey, steps)
#screen action of the device
def setOrientation(self,scrAct='natural', choiceDevice='mstr'):
'''
Description
param
d.orientation = 'l' or 'left'
d.orientation = 'r' or 'right'
d.orientation = 'n' or 'natural'
示例2: UiTestLib
# 需要导入模块: from uiautomator import Device [as 别名]
# 或者: from uiautomator.Device import long_click [as 别名]
#.........这里部分代码省略.........
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()
def long_click_text(self, text, instance=0):
"""
Long Click text label on screen, *text* and *instance=0*
Example:
| Action | Argument | Argument |
| Long Click Text | text | instance |
"""
return self.d(text=text, instance=instance).long_click()
def long_click_ui(self, **selectors):
"""
Long Click on **selectors**
Selector supports below parameters. Refer to UiSelector java doc for detailed information.
text, textContains, textMatches, textStartsWith
className, classNameMatches
description, descriptionContains, descriptionMatches, descriptionStartsWith
checkable, checked, clickable, longClickable
scrollable, enabled,focusable, focused, selected
packageName, packageNameMatches
resourceId, resourceIdMatches
index, instance
Example:
| Action | Argument | Argument | Argument |
| Long Click UI | text=XXXX | className=XXX.xxxx | resourceId=xxxxxx |
"""
return self.d(**selectors).long_click()
def text_display_on_screen_contains(self, text):
"""Verify text display on screen