当前位置: 首页>>代码示例>>Python>>正文


Python device.press函数代码示例

本文整理汇总了Python中uiautomatorplug.android.device.press函数的典型用法代码示例。如果您正苦于以下问题:Python press函数的具体用法?Python press怎么用?Python press使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了press函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testSwitchTheme

	def testSwitchTheme(self):
		d.start_activity(component='com.android.settings/.Settings')
		assert d(text = '设置').wait.exists(timeout = 5000),'Launch settings failed in 5s!'
		u.selectOption('主题、壁纸、图标')
		assert d(resourceId = 'smartisanos:id/tv_title',text = '主题、壁纸、图标').wait.exists(timeout = 5000),'Switch to theme view failed in 5s!'
		u.selectOption('桌面主题')
		assert d(resourceId = 'com.smartisanos.launcher:id/tv_title',text = '桌面主题').wait.exists(timeout = 5000),'Switch to theme view failed in 5s!'
		for i in range(30):
			for theme in THEME_LIST:
				if i==0 and theme == '经典':
					continue
				d.start_activity(component='com.android.settings/.Settings')
				assert d(resourceId = 'com.smartisanos.launcher:id/tv_title',text = '桌面主题').wait.exists(timeout = 5000),'Switch to theme view failed in 5s!'
				if theme == '经典':
					d(resourceId = 'com.smartisanos.launcher:id/list_theme').swipe.down()
					d(resourceId = 'com.smartisanos.launcher:id/list_theme').swipe.down()
					d(resourceId = 'com.smartisanos.launcher:id/list_theme').swipe.down()
					d.sleep(1)
				u.selectOption(theme)
				assert d(resourceId = 'smartisanos:id/tv_title',text = theme).wait.exists(timeout = 5000),'Switch to theme thumbnail failed in 5s!'
				d(text = '设定').click.wait()
				assert d(text = '正在加载主题').wait.exists(timeout = 5000),'Loading theme view does not show up in 5s!'
				assert d(text = '正在加载主题').wait.gone(timeout = 10000),'Loading theme view does not disappeared in 10s!'
				assert d(resourceId = 'com.smartisanos.launcher:id/glview').wait.exists(timeout = 5000), 'Switch to launcher failed in 5s!'
				d.sleep(3)
		# exit theme setting
		d.start_activity(component='com.android.settings/.Settings')
		d.press('back')
开发者ID:BowenXiao,项目名称:998_Memory,代码行数:28,代码来源:launcher.py

示例2: tearDown

def tearDown():
	for i in xrange(2):
		d.press('back')
	if d(textContains = '退出').exists:
		d(text = '确定').click()
	d.press('home')
	checkSystemWatchers()
开发者ID:BowenXiao,项目名称:998_Stability,代码行数:7,代码来源:util.py

示例3: testGame

	def testGame(self):
		#Launch DiTiePaoKu
		d.start_activity(component='com.kiloo.subwaysurf/.RRAndroidPluginActivity')
		assert d(packageName = 'com.kiloo.subwaysurf').wait.exists(timeout = 5000),'Launch game failed in 5s!'
		d.sleep(10)
		if d(text = '地铁跑酷正试图发送短信').exists:
			d(text = '允许').click.wait()
		if d(text = '地铁跑酷正试图获取位置信息').exists:
			d(text = '允许').click.wait()
		if d(text = '免费礼包大派送').exists:
			d(text = '7天内不再显示').click.wait()
			d(text = '暂不领取').click.wait()
		if d(text = '提示').exists:
			d(text = '取消').click.wait()
		if d(className = 'android.widget.TextView').exists:
			d(className = 'android.widget.TextView').click.wait()

		#Click screen to start game
		d.click(300,1540)
		d.sleep(4)

		for i in range(900):
			direction = random.choice(['left','right','up','down'])
			step = random.randint(2,20)
			self._swipeGame(direction,step)
			d.sleep(1)

		#Exit game
		d.press('back')
		d.sleep(1)
		d.click(150,1800)
		d.sleep(1)
		d.click(700,1100)
		d.sleep(1)
开发者ID:BowenXiao,项目名称:3000_stability,代码行数:34,代码来源:the3rd.py

示例4: testDownloadPics

	def testDownloadPics(self):
		#Launch Browser
		self._launchBrowser()

		#Input download pics url
		d(resourceId = 'com.android.browser:id/url', text = '输入网址').set_text('auto.smartisan.com/media/Auto_Test_Image.jpg')
		d.sleep(1)
		d.press('enter')
		d.sleep(5)
		# swipe up to show '普通下载'
		d.long_click(500, 670)
		d.sleep(1)
		assert d(text = '保存图片').wait.exists(timeout = 5000),'Save download window does not pop-up in 5s!'
		d(text = '保存图片').click()
		if  d(textContains = '您正在通过移动数据下载').wait.exists(timeout=1000):
			d(text = '继续').click.wait()
		
		#Looping 60s to check if download is ok
		for i in range(60):
			if u.getFileCount('/sdcard/Download', 'jpg') > 0:
				return
			d.sleep(1)
		assert False, 'Can not download pics in 60s. '

		#Close all webpage windows and clear downloaded resource
		#self._closeWindows()
		self._clearData()
开发者ID:BowenXiao,项目名称:998_Stability,代码行数:27,代码来源:browser.py

示例5: 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

示例6: testPlayStreamingVideo

	def testPlayStreamingVideo(self):
		#Start Browser
		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!'
		d(resourceId = 'com.android.browser:id/newtab_btn').click.wait()

		# input download audio url
		d(resourceId = 'com.android.browser:id/url', text = '输入网址').set_text('auto.smartisan.com/media/Auto_Test_Video.mp4')
		d.press('enter')
		# play without element on webpage
#		d.sleep(10)
#		#d.click('Streaming_Play.png')
#		d.click(540,960)
#		#d(description = '播放').click.wait()
#		assert d(description = '网页视图').wait.exists(timeout = 15000),'Loading streaming video failed in 15s!'
#		# play time
#		d.sleep(15)
#		#assert d(description = '媒体控件').wait.exists(timeout = 10000),'Switch to webview failed in 10s!'
#		if d.orientation != 'natural':
#			d.orientation = 'n'

		#play with element on webpage
		assert d(description = '播放').wait.exists(timeout = 20000),'Loading webpage failed in 20s!'
		d(description = '播放').click.wait()
		assert d(description = '视频').wait.exists(timeout = 10000),'Start playing streaming video failed in 10s!'
		d.sleep(10)
开发者ID:BowenXiao,项目名称:998_Stability,代码行数:26,代码来源:multimedia.py

示例7: testSwitchSong

 def testSwitchSong(self):
     """
     launch  app store and exit
     """
     for i in xrange(8):
         d.press('right')
     assert d(text="网络电台").exists, 'FM app icon not found!'
     d(text="网络电台").click.wait()
     assert d(resourceId='com.xiaomi.mimusic:id/play_btn').wait.exists(timeout=10000), 'Open FM failed!'
     d.sleep(10)
     assert d(resourceId='com.xiaomi.mimusic:id/title').child(className="android.widget.TextView").exists, 'song play screen not found!'
     first_song_name = d(resourceId='com.xiaomi.mimusic:id/title').child(className="android.widget.TextView").info['text']
     d.press('right')
     d.sleep(15)
     assert d(resourceId='com.xiaomi.mimusic:id/title').child(className="android.widget.TextView").exists, 'song play screen not found!'
     second_song_name = d(resourceId='com.xiaomi.mimusic:id/title').child(className="android.widget.TextView").info['text']
     assert not second_song_name == first_song_name, 'switch song failed!'
     d.press('right')
     d.sleep(15)
     assert d(resourceId='com.xiaomi.mimusic:id/title').child(className="android.widget.TextView").exists, 'song play screen not found!'
     third_song_name = d(resourceId='com.xiaomi.mimusic:id/title').child(className="android.widget.TextView").info['text']
     assert not third_song_name == second_song_name, 'switch song failed!'
     d.press('back')
     d.sleep(2)
     d.press('back')
开发者ID:hongbinbao,项目名称:mitv_public,代码行数:25,代码来源:fm.py

示例8: 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

示例9: _removeIdentity

 def _removeIdentity(self):
     u.tapOnCenter() #Tap on the face on image
     #Below is to remove the exists face recognize
     if d(description = 'Edit menu').wait.exists(timeout = 2000):
         self._editFDFR('Remove identity')
     else:
         d.press('back')
开发者ID:BowenXiao,项目名称:Social_Gallery_Feature_Test_Uiautomator,代码行数:7,代码来源:FullViewFDFR.py

示例10: testLaunchAndExitMiracast

 def testLaunchAndExitMiracast(self):
     for i in xrange(4):
         d.press('right')
     assert d(text="无线显示").exists, 'Miracast icon not found!'
     d(text="无线显示").click.wait()
     d.press('back')
     assert d(text="无线显示").wait.exists(timeout=10000), 'exit from Miracast failed!'
开发者ID:hongbinbao,项目名称:mibox_public,代码行数:7,代码来源:tests.py

示例11: test_fm_copy

 def test_fm_copy(self):
     self._launch_apps()
     d(resourceId="com.chaozhuo.filemanager:id/text_navigation_child",text=u"文档").click()
     time.sleep(2)
     d(resourceId="com.chaozhuo.filemanager:id/more").click()
     time.sleep(2)
     d(resourceId="com.chaozhuo.filemanager:id/item_title", text=u"新建文件").click()
     time.sleep(2)
     d(resourceId="com.chaozhuo.filemanager:id/file_name_edit").set_text("test.txt")
     time.sleep(2)
     d.press("enter")
     time.sleep(2)
     d(resourceId="com.chaozhuo.filemanager:id/node_list").click()
     time.sleep(2)
     d(resourceId="com.chaozhuo.filemanager:id/more").click()
     time.sleep(2)
     d(resourceId="com.chaozhuo.filemanager:id/item_title", text=u"全选").click()
     time.sleep(2)
     d(resourceId="com.chaozhuo.filemanager:id/copy",text=u"复制").click()
     time.sleep(2)
     for i in xrange(100):
         d(resourceId="com.chaozhuo.filemanager:id/more").click()
         time.sleep(2)
         d(resourceId="com.chaozhuo.filemanager:id/item_title", text=u"粘贴").click()
         time.sleep(2)
开发者ID:huashuolee,项目名称:borqs_stress,代码行数:25,代码来源:fm_copy.py

示例12: test_fm_copy

 def test_fm_copy(self):
     u.recordcase(self.test_fm_copy, "FileManager.Priority1")
     self._launch_filemanager()
     d(resourceId="com.chaozhuo.filemanager:id/text_navigation_child", text=u"文档").click()
     time.sleep(2)
     d(resourceId="com.chaozhuo.filemanager:id/more").wait(5000)
     d(resourceId="com.chaozhuo.filemanager:id/more").click()
     time.sleep(2)
     d(resourceId="com.chaozhuo.filemanager:id/item_title", text=u"新建文件").click()
     time.sleep(2)
     d(resourceId="com.chaozhuo.filemanager:id/file_name_edit").set_text("test.txt")
     time.sleep(2)
     d.press("enter")
     time.sleep(2)
     d(resourceId="com.chaozhuo.filemanager:id/node_list").click()
     time.sleep(2)
     d(resourceId="com.chaozhuo.filemanager:id/more").click()
     time.sleep(2)
     d(resourceId="com.chaozhuo.filemanager:id/item_title", text=u"全选").click()
     time.sleep(2)
     d(resourceId="com.chaozhuo.filemanager:id/copy", text=u"复制").click()
     time.sleep(2)
     for i in xrange(self.loop):
         d(resourceId="com.chaozhuo.filemanager:id/more").click()
         time.sleep(2)
         d(resourceId="com.chaozhuo.filemanager:id/item_title", text=u"粘贴").click()
         time.sleep(2)
     u.log()
开发者ID:huashuolee,项目名称:borqs_stress,代码行数:28,代码来源:main.py

示例13: testSendEmailNoAtt

	def testSendEmailNoAtt(self):
		#Launch Email
		self._launchEmail()

		#Edit mail content and then send out
		d(resourceId = 'com.android.email:id/compsoe_view').click.wait()
		assert d(text = '写邮件').wait.exists(timeout = 5000),'Switch to compose view failed in 5s!'
		d(resourceId = 'com.android.email:id/to_recipient_view').set_text(SEND_TO)
		d.press('enter')
		d(resourceId = 'com.android.email:id/subject').set_text(SUBJECT)
		d(resourceId = 'com.android.email:id/body').set_text(BODY)
		d(text = '发送').click.wait()
		assert d(text = '设置').wait.exists(timeout = 5000),'Switch to mail list (after click send icon) failed in 5s!'

		#Delete mail from sendbox
		d(resourceId = 'com.android.email:id/options_view').click.wait()
		assert d(resourceId = 'com.android.email:id/bottom_dialog_title_text',text = 'Exchange').wait.exists(timeout = 5000),'Trigger menu list failed in 5s!'
		d(text = '已发送邮件').click.wait()
		assert d(resourceId = 'com.android.email:id/title',text = '已发送邮件').wait.exists(timeout = 5000),'Switch to sended box failed in 5s!'
		# looping 60s to check if mail sending finished
		for i in range(12):
			#d(resourceId = 'com.android.email:id/refresh_view').click.wait()
			if d(descriptionContains = SUBJECT).wait.exists(timeout=5000):
				break
			if i == 11:
				assert False, 'Can not send out email in 60s. '
			d(resourceId = 'com.android.email:id/refresh_view').click.wait()
		d(descriptionContains = SUBJECT).click.wait()
		if d(descriptionContains = SUBJECT).exists:
			d(descriptionContains = SUBJECT).click.wait()
		assert d(resourceId = 'com.android.email:id/send_calendar_btn').wait.exists(timeout = 5000),'Open mail failed in 5s!'
		d(resourceId = 'com.android.email:id/detail_delete_view').click.wait()
		d(text = '确认删除').click.wait()
		assert d(text = '来往邮件').wait.exists(timeout = 5000),'Switch to sending box failed (after delete send mail) in 5s!'
开发者ID:BowenXiao,项目名称:3000_stability,代码行数:34,代码来源:email.py

示例14: showPopCard

 def showPopCard(self):
     d.click(self.getSizeOfGallery()[4], self.getSizeOfGallery()[0] + 1)
     d(description = 'More options').click.wait()
     if d(text = 'View photonotes').wait.exists(timeout = 2000):
         d(text = 'View photonotes').click.wait()
     else:
         d.press('back')
     time.sleep(1)
开发者ID:GuanjunXu,项目名称:Gallery_FT_BB,代码行数:8,代码来源:util.py

示例15: testLaunchMultipleApp

 def testLaunchMultipleApp(self):
     # Launch an
     for app in MULTIPLE_APP_LIST:
         d.start_activity(component=app)
         assert d(packageName=MULTIPLE_APP_LIST[app]).wait.exists(timeout=5000), "Launch %s failed in 5s" % app
         d.sleep(5)
         d.press("home")
         d.sleep(1)
开发者ID:GuanjunXu,项目名称:998_Stability,代码行数:8,代码来源:multitask.py


注:本文中的uiautomatorplug.android.device.press函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。