本文整理汇总了Python中uiautomatorplug.android.device.swipe函数的典型用法代码示例。如果您正苦于以下问题:Python swipe函数的具体用法?Python swipe怎么用?Python swipe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了swipe函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: testLaunchGalleryFromMS
def testLaunchGalleryFromMS(self):
commands.getoutput('adb shell am start -n com.android.videoeditor/.ProjectsActivity')
#self._creatMovieStudioProject()
time.sleep(2)
d.swipe(360,360,361,361) #Hold on the first item in media list
if d(text = 'Delete project').wait.exists(timeout = 2000):
while d(text = 'Delete project').wait.exists(timeout = 2000):
d(text = 'Delete project').click.wait()
if d(text = 'Yes').wait.exists(timeout = 2000):
d(text = 'Yes').click.wait()
time.sleep(2)
d.swipe(360,360,361,361)
if d(text = 'Cancel').wait.exists():
d(text = 'Cancel').click.wait()
else:
d(text = 'Cancel').click.wait()
self.createMovie()
for i in range(0,100):
time.sleep(2)
d(resourceId = 'com.android.videoeditor:id/add_new_media_item_menu').click.wait()
assert d(text = 'Import image').wait.exists(timeout = 1000),'enter import image menu fail'
d(text = 'Import image').click.wait()
time.sleep(1)
self._selectIntelGallery()
self._pressBack(1)
开发者ID:BowenXiao,项目名称:Social_Gallery_Stress_Test_Uiautomator,代码行数:25,代码来源:stressBurst.py
示例2: testDownloadVideo
def testDownloadVideo(self):
#Launch Browser
self._launchBrowser()
# input download audio url
d(resourceId = 'com.android.browser:id/url', text = '输入网址').set_text('http://pan.baidu.com/s/1eQcRK3o')
d.press('enter')
d.sleep(5)
d.swipe(540,1400,540,400,100)
# click download
d.click(800,1550)
assert d(text = '是否下载该文件?').wait.exists(timeout = 10000), 'Not trigger download. '
d(text = '下载').click.wait()
if d(textContains = '您正在通过移动数据下载').exists:
d(text = '继续').click.wait()
#Looping 60s to check if download is ok
for i in range(60):
if u.getFileCount('/sdcard/Download', 'mp4') > 0:
return
d.sleep(1)
assert False, 'Can not download video in 60s. '
#Close all webpage windows and clear downloaded resource
#self._closeWindows()
self._clearData()
开发者ID:BowenXiao,项目名称:998_Stability,代码行数:25,代码来源:browser.py
示例3: setCameraSetting
def setCameraSetting(self,mode,sub_mode,option):
'''
This method is used to set camera to one mode, sub-mode, and do any operate of this sub-mode.
7 = Max element count in screen.
2 = Length of settings - Max screen count
Please input index number as sub_mode, input index number of options as option
Such as:
setCameraSetting('single',3,2)
'single' means mode
3 means the index number of Location in sub_mode list
2 means the index number of Location off option in options list
'''
settings = MODE[mode]
if sub_mode== 'flash':
self._setFlashMode(option)
elif sub_mode == 'fdfr':
self._setFDFRMode(option)
else:
d(resourceId = 'com.intel.camera22:id/left_menus_camera_setting').click.wait(timeout=2000)
if sub_mode <= 7:
d(resourceId = HORI_LIST_BUTTON)[sub_mode-1].click.wait()
if len(settings) >= 7:
d(resourceId = HORI_LIST_BUTTON)[option+7-1].click.wait()
else:
d(resourceId = HORI_LIST_BUTTON)[option+len(settings)-1].click.wait()
else:
d.swipe(680,180,100,180)
d(resourceId = HORI_LIST_BUTTON)[sub_mode-2-1].click.wait()
d(resourceId = HORI_LIST_BUTTON)[option+7-1].click.wait()
开发者ID:BowenXiao,项目名称:Social_Camera_Stress_Test_Uiautomator,代码行数:32,代码来源:util.py
示例4: _editImage
def _editImage(self,bottombutton,suboption,cropscale=None):
'''
You need just know the NO. of the wanted option, e.g.:
you want to set an image as 'Hue' in 'Colors',
-> _editImage('colors',9)
*Hue is NO.9 in the option list
*An exception, if you set something in geometry(3rd button on the bottom), you may use func like:
-> _editImage('geometry','crop')
*You could just use the string shows on screen
Comparison Table:
NO.| bottombutton | suboption | cropscale
-------+--------------+----------------------+---------------------
1. | fx | int 1 ~ 10 |
2. | border | int 1 ~ 7 |
3. | geometry | str straighten |
| | crop | str 1:1
| | | 4:3
| | | 3:4
| | | 5:7
| | | 7:5
| | | None
| | | Original
| | rotate |
| | flip (*'Mirror') |
4. | colors | int 1 ~ 11 |
-------+--------------+----------------------+---------------------
'''
u.setMenuOptions('Edit')
#Click bottom button
d(resourceId = 'com.intel.android.gallery3d:id/%sButton'%bottombutton).click.wait()
if bottombutton == 'geometry':
d(resourceId = 'com.intel.android.gallery3d:id/%sButton'%suboption).click.wait()
else:
if suboption < 6:
d()[17 + suboption - 1].click.wait()
#d.click(XITEM + XUNIT * (suboption - 1), YSUB)
elif suboption == 11:
d.swipe(XMAX-1, YSUB, 0, YSUB, 5) #Swipe to the end
#d.click(XITEM + XUNIT * 4, YSUB)
d(index = suboption-1,focusable = 'false',clickable = 'true').click.wait()
else:
d.swipe(XMAX-1, YSUB, 0, YSUB, 60) #Swipe the 5th item to the 0 position(out of screen)
#d.click(XITEM + XUNIT * (suboption - ITEMCOUNT - 1), YSUB)
d(index = suboption-1,focusable = 'false',clickable = 'true').click.wait()
#When croping image, there are some expend options
if cropscale != None:
d(resourceId = 'com.intel.android.gallery3d:id/aspect').click.wait()
d(text = cropscale).click.wait()
#Some effect may need user's applying
if d(text = 'Apply').wait.exists(timeout = 2000):
d(text = 'Apply').click.wait()
#Save the changed image
d(text = 'SAVE').click.wait()
开发者ID:BowenXiao,项目名称:Social_Gallery_Feature_Test_Uiautomator,代码行数:60,代码来源:FullViewEdit.py
示例5: _editImage
def _editImage(self,bottombutton,suboption,cropscale=None):
'''
You need just know the NO. of the wanted option, e.g.:
you want to set an image as 'Hue' in 'Colors',
-> _editImage('colors',9)
*Hue is NO.9 in the option list
*An exception, if you set something in geometry(3rd button on the bottom), you may use func like:
-> _editImage('geometry','crop')
*You could just use the string shows on screen
Comparison Table:
NO.| bottombutton | suboption | cropscale
-------+--------------+----------------------+---------------------
1. | fx | int 1 ~ 10 |
2. | border | int 1 ~ 7 |
3. | geometry | str straighten |
| | crop | str 1:1
| | | 4:3
| | | 3:4
| | | 5:7
| | | 7:5
| | | None
| | | Original
| | rotate |
| | flip (*'Mirror') |
4. | colors | int 1 ~ 11 |
-------+--------------+----------------------+---------------------
'''
d(resourceId = 'com.intel.android.gallery3d:id/action_edit').click.wait()
if d(text = 'Choose an action').wait.exists():
d(text = 'com.intel.android.gallery3d').click.wait()
#Click bottom button
d(resourceId = 'com.intel.android.gallery3d:id/%sButton'%bottombutton).click.wait()
if bottombutton == 'geometry':
d(resourceId = 'com.intel.android.gallery3d:id/%sButton'%suboption).click.wait()
else:
if suboption < 10:
d()[24 + suboption].click.wait()
elif suboption == 11:
d.swipe(self._getSubSize()[0]-1, self._getSubSize()[1], 0, self._getSubSize()[1], 5)
d(index = suboption-1,focusable = 'false',clickable = 'true').click.wait()
else:
d.swipe(self._getSubSize()[0]-1, self._getSubSize()[1], 0, self._getSubSize()[1])
d(index = suboption-1,focusable = 'false',clickable = 'true').click.wait()
#When croping image, there are some expend options
if cropscale != None:
d(resourceId = 'com.intel.android.gallery3d:id/aspect').click.wait()
d(text = cropscale).click.wait()
#Some effect may need user's applying
if d(text = 'Apply').wait.exists(timeout = 2000):
d(text = 'Apply').click.wait()
#Save the changed image
d(description = 'SAVE').click.wait()
开发者ID:BowenXiao,项目名称:Gallery_FT_BB,代码行数:59,代码来源:FullViewEdit.py
示例6: setUp
def setUp(self):
super(GalleryTest,self).setUp()
#Add on May 26th due to device always reboot by itself
if d(text = 'Charged').wait.exists(timeout = 2000):
commands.getoutput('adb root')
time.sleep(5)
commands.getoutput('adb remount')
d.swipe(360,980,719,980)
开发者ID:BowenXiao,项目名称:Social_Gallery_Stress_Test_Uiautomator,代码行数:8,代码来源:stressBurst.py
示例7: _slideOptionRightToLeft
def _slideOptionRightToLeft(self, optiontext):
# <<<---
x_1 = (self._getSettingBounds())[0] - (self._getOptionWidthAndHeight())[0]
x_2 = (
(self._getSettingBounds())[0] - (self._getOptionWidthAndHeight())[0] - (self._getOptionWidthAndHeight())[0]
)
y = self._getOptionOrdinate(optiontext)
d.swipe(x_1, y, x_2, y)
开发者ID:GuanjunXu,项目名称:util_for_BB,代码行数:8,代码来源:util.py
示例8: _slideOptionRightToLeft
def _slideOptionRightToLeft(self,optiontext,diffindex):
# <<<---
x_1 = self._getSettingBounds()[0] - self._getOptionWidthAndHeight()[0]
x_2 = self._getSettingBounds()[0] - self._getOptionWidthAndHeight()[0] - self._getOptionWidthAndHeight()[0]
y = self._getOptionOrdinate(optiontext)
x_i = self._getOptionWidthAndHeight()[0] * (diffindex - 1)
d.swipe(x_1, y, x_2 - x_i, y)
time.sleep(2)
开发者ID:GuanjunXu,项目名称:Social_Camera_2.3_FT_BB,代码行数:8,代码来源:util.py
示例9: setUp
def setUp(self):
super(GalleryTest,self).setUp()
#Add on May 26th due to device always reboot by itself
if d(text = 'Charged').wait.exists(timeout = 2000):
commands.getoutput('adb root')
time.sleep(5)
commands.getoutput('adb remount')
d.swipe(530,1300,1000,1300)
u._clearAllResource()
开发者ID:chengguopiao,项目名称:Gallery_util,代码行数:9,代码来源:stressFullView.py
示例10: launchSettings
def launchSettings():
d.start_activity(component='com.android.settings/.Settings')
while d(resourceId = 'smartisanos:id/btn_back').exists:
d(resourceId = 'smartisanos:id/btn_back').click.wait()
if not d(text = '无线网络').exists:
for i in range(4):
if d(text = '无线网络').exists:
break
d.swipe(360,200,360,1000,50)
assert d(text = '设置').wait.exists(timeout = 5000),'Launch settings failed in 5s!'
开发者ID:BowenXiao,项目名称:998_Stability,代码行数:10,代码来源:util.py
示例11: setUp
def setUp(self):
super(GalleryTest,self).setUp()
#Add on May 26th due to device always reboot by itself
if d(text = 'Charged').wait.exists(timeout = 2000):
commands.getoutput('adb root')
time.sleep(5)
commands.getoutput('adb remount')
d.swipe(360,980,719,980)
u._clearAllResource()
u._checkBurstResource()
u.launchGallery()
self._enterBurstView()
开发者ID:BowenXiao,项目名称:Social_Gallery_Feature_Test_Uiautomator,代码行数:12,代码来源:burstview.py
示例12: selectOption
def selectOption(option):
i = 1
while i:
if d(text = option).exists:
break
d.swipe(540,1400,540,400,100)
d.sleep(1)
i+=1
if d(text = option).exists or i==10:
break
d.sleep(1)
d(text = option).click.wait()
开发者ID:BowenXiao,项目名称:998_Stability,代码行数:12,代码来源:util.py
示例13: selectPictueWhenEditBurst
def selectPictueWhenEditBurst(self,imagesSelect):
#Could display 5 pictures on selection bar at most, when the count of image selected bigger than 5, need swipe
x = 70 #The abscissa of the first picture
while imagesSelect > 0:
d.click(x, 250)
time.sleep(1) #Sometimes case failed if tap action is too fast
x = x + 150 #The gap between two pictures are 150 pix
if x > 700: #The left boundry of the fifth image, so if abscissa over than 600, need swipe
d.swipe(650,250,1,250,steps=5)
time.sleep(1)
x = 70 #Reset the first abscissa
imagesSelect = imagesSelect - 1
开发者ID:BowenXiao,项目名称:Social_Gallery_Feature_Test_Uiautomator,代码行数:12,代码来源:util.py
示例14: testTagOnePicture
def testTagOnePicture(self):
u._confirmResourceExists()
u.launchGallery()
u.enterXView('fullview')
u.showPopCard()
u.setMenuOptions('Details')
for i in range(100):
d.swipe(500,1050,500,200) #Swipe detail list up
d(resourceId = 'com.intel.android.gallery3d:id/addKeywordButton').click.wait()
d(text = 'Enter new keyword').click.wait() #Make sure keyboard has been invoked
d(text = 'Enter new keyword').set_text('NewKeyword')
self._tapOnDoneButton()
assert d(text = 'NewKeyword',className = 'android.widget.TextView').wait.exists(timeout = 2000)
开发者ID:GuanjunXu,项目名称:Social_Gallery_Stress_Test_Uiautomator,代码行数:13,代码来源:stressFullView.py
示例15: setUp
def setUp(self):
super(GalleryTest,self).setUp()
#Add on May 26th due to device always reboot by itself
if d(text = 'Charged').wait.exists(timeout = 2000):
commands.getoutput('adb root')
time.sleep(5)
commands.getoutput('adb remount')
d.swipe(530,1300,1000,1300)
u._clearAllResource()
u._confirmResourceExists()
u.launchGallery()
u.enterXView('fullview')
u.showPopCard()
开发者ID:GuanjunXu,项目名称:Gallery23_FT_v1,代码行数:13,代码来源:FullViewMenu.py
示例16: setUp
def setUp(self):
super(GalleryTest,self).setUp()
#Add on May 26th due to device always reboot by itself
if d(text = 'Charged').wait.exists(timeout = 2000):
commands.getoutput('adb root')
time.sleep(5)
commands.getoutput('adb remount')
d.swipe(360,980,719,980)
u._clearAllResource()
u._confirmResourceExists()
u.launchGallery()
u.enterXView('fullview')
self._turnFDFR('On')
self._removeIdentity()
开发者ID:BowenXiao,项目名称:Social_Gallery_Feature_Test_Uiautomator,代码行数:14,代码来源:FullViewFDFR.py
示例17: testVisitWebPage4G
def testVisitWebPage4G(self):
# turn off wifi
self._setWifistatus('off')
d.sleep(3)
#Launch Browser
self._launchBrowser()
# visite webpage
d(resourceId = 'com.android.browser:id/url', text = '输入网址').set_text(TOP5[3])
d.press('enter')
d.expect(CHECK_POINT[3], timeout=15)
# browse webpage
d.swipe(1000,1300,1000,600,10)
d.sleep(1)
d.swipe(1000,1300,1000,600,10)
d.sleep(1)
d.swipe(1000,600,1000,1300,10)
d.sleep(1)
d.swipe(1000,600,1000,1300,10)
d.sleep(1)
# turn on wifi
self._setWifistatus('on')
d.start_activity(component='com.android.browser/.BrowserActivity')
assert d(resourceId = 'com.android.browser:id/switch_btn').wait.exists(timeout = 5000),'Launch browser failed in 5s!'
开发者ID:BowenXiao,项目名称:998_Stability,代码行数:25,代码来源:browser.py
示例18: testAddKeyWords
def testAddKeyWords(self):
'''
Summary: Add keywords by setting meny
Steps: 1.Enter full view
2.Add keywords in settings bar
3.Click “+” to add new keywords to this photo
'''
u.setMenuOptions('Details')
d.swipe(1000,1600,1000,200) #Swipe detail list up
d(resourceId = 'com.intel.android.gallery3d:id/addKeywordButton').click.wait()
d(text = 'Enter new keyword').click.wait() #Make sure keyboard has been invoked
d(text = 'Enter new keyword').set_text('NewKeyword')
self._tapOnDoneButton()
assert d(text = 'NewKeyword',className = 'android.widget.TextView').wait.exists(timeout = 2000)
开发者ID:GuanjunXu,项目名称:Gallery23_FT_v1,代码行数:14,代码来源:FullViewMenu.py
示例19: selectOption
def selectOption(option):
i = 1
while i:
if d(text = option).exists:
break
return True
d.swipe(360,1000,360,200,50)
d.sleep(1)
i+=1
if i==10:
assert d(text = option).wait.exists(timeout = 3000),'%s is not in the list!'%option
break
return False
d.sleep(1)
d(text = option).click.wait()
开发者ID:BowenXiao,项目名称:998_Memory,代码行数:15,代码来源:util.py
示例20: unlock
def unlock():
'''
unlock() 解锁屏幕,黑屏或其他状态解锁屏幕。
return boolean
'''
d.wakeup()
lockscreen = d(className = 'android.widget.ImageView',resourceId = 'com.smartisanos.keyguard:id/desk_kg')
if lockscreen.exists:
x = d.info['displayWidth']
y = d.info['displayHeight']
d.swipe(x/2,int(y/1.5),x/2,0,20)
if not lockscreen.exists:
return True
else:
return False
开发者ID:BowenXiao,项目名称:998_Stability,代码行数:15,代码来源:util.py
注:本文中的uiautomatorplug.android.device.swipe函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论