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


Python device.sleep函数代码示例

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


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

示例1: testSingleViewSwipe

	def testSingleViewSwipe(self):
		# swipe home screen 1000 times totally
		for i in range(500):
			direction = random.choice(['left','right'])
			step = random.randint(5,50)
			self._swipeScreen(direction,step)
			d.sleep(1)
开发者ID:BowenXiao,项目名称:998_Memory,代码行数:7,代码来源:launcher.py

示例2: testAddDelContact

	def testAddDelContact(self):
		#Launch phone app
		self._launchPhone()

		#Select Contacts
		d(text = '联系人').click.wait()
		assert d(text = '群组').wait.exists(timeout=5000),'Switch to phone book failed in 5s!'

		#Add new contact
		d(text = '添加').click.wait()
		assert d(text = '本地保存').wait.exists(timeout = 5000),'Pop-up reserve method failed in 5s!'
		d(text = '本地保存').click.wait()
		assert d(text = '新建 本地 联系人').wait.exists(timeout = 5000),'Switch to create contacts failed in 5s!'
		d(text="姓名").set_text("adele")
		# click the top of screen, prevent the duplication
		d.sleep(1)
		d.click(580,170)
		d(className = 'android.widget.EditText', text="电话").set_text('15050505050')
		d(text = '完成').click.wait()
		assert d(text = '联系人详情').wait.exists(timeout = 5000),'Switch to contacts detail failed in 5s!'
		assert d(text = 'adele').wait.exists(timeout = 5000), 'adele is not show on screen!'

		#Delete contact
		d(text = '删除此联系人').click.wait()
		assert d(textContains = '要删除联系人吗').wait.exists(timeout = 5000),'Delete confirm info does not pop-up in 5s!'
		d(text = '确认删除').click.wait()
		assert d(text = 'adele').wait.gone(timeout = 5000),'Delete contact failed in 5s!'
开发者ID:BowenXiao,项目名称:3000_stability,代码行数:27,代码来源:telephony.py

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

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

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

示例6: testReadEmailWithAtt

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

		#Get into star box
		d(resourceId = 'com.android.email:id/options_view').click.wait()
		#assert d(resourceId = 'com.android.email:id/bottom_dialog_title_text').wait.exists(timeout = 5000),'Pop-up menu list failed in 5s!'
		d(text = '已加旗标').click.wait()
		assert d(resourceId = 'com.android.email:id/title',text = '已加旗标').wait.exists(timeout = 5000),'Switch Star box failed in 5s!'

		# check inbox
		for i in range(30):
			d.sleep(1)
			if d(descriptionContains = ATT_SUBJECT).exists:
				break
			d(resourceId = 'com.android.email:id/refresh_view').click.wait()
		# check received mail
		assert d(descriptionContains = ATT_SUBJECT).exists,'Do not received mail!'
		d(descriptionContains = ATT_SUBJECT).click()
		assert d(resourceId = 'com.android.email:id/send_calendar_btn').wait.exists(timeout = 5000),'Switch to mail detail failed in 5s!'
		# check attachment
		if  d(text = '加载').exists:
			d(text = '加载').click.wait()
		assert d(text = '打开').wait.exists(timeout = 15000),'Download attachment failed in 15s!'
		d(text = '打开').click.wait()
		assert d(text = '选择要使用的应用').wait.exists(timeout = 5000),"'选择要使用的应用' does not pop up in 5s!"
		d(text = '相册').click.wait()
		assert d(packageName = 'com.android.gallery3d').wait.exists(timeout = 5000),'Switch to gallery view failed in 5s!'
开发者ID:BowenXiao,项目名称:3000_stability,代码行数:28,代码来源:email.py

示例7: _clearCache

	def _clearCache(self):
		# close all webpage
		d(resourceId = 'com.android.browser:id/switch_btn').click.wait()
		d(resourceId = 'com.android.browser:id/clearall').click.wait()
		d(text = '关闭').click.wait()
		# clear cache
		d(resourceId = 'com.android.browser:id/menu_btn').click.wait()
		d.sleep(2)
		#select setting in option list
		d.click(590,1700)
		#d(resourceId = 'com.android.browser:id/option_list_item_text',text = '设置').click.wait()
		assert d(text = '设置').wait.exists(timeout = 3000),'Switch to setting view failed in 3s!'
		d(text = '隐私和安全').click.wait()
		assert d(resourceId = 'com.android.browser:id/action_new_event_text',text = '隐私和安全').wait.exists(timeout = 3000),'Switch to event view failed in 3s!'
		d(text = '清除缓存').click.wait()
		if  d(resourceId = 'android:id/alertTitle',text = '清除缓存').exists:
			d(text = '确定').click.wait()
		d(text = '清除历史记录').click.wait()
		if  d(resourceId = 'android:id/alertTitle',text = '清除历史记录').exists:
			d(text = '确定').click.wait()
		d(text = '清除所有 Cookie 数据').click.wait()
		if  d(resourceId = 'android:id/alertTitle',text = '清除所有 Cookie 数据').exists:
			d(text = '确定').click.wait()
		d(text = '返回').click.wait()
		d(text = '完成').click.wait()
开发者ID:BowenXiao,项目名称:998_Stability,代码行数:25,代码来源:browser.py

示例8: testShareNoteToWeibo

	def testShareNoteToWeibo(self):
		# Launch Note
		d.start_activity(component='com.smartisanos.notes/.NotesActivity')
		assert d(text = '便签').wait.exists(timeout = 5000),'Launch Note failed in 5s!'
		for i in range(500):
			d(resourceId = 'com.smartisanos.notes:id/add_button').click.wait()
			assert d(resourceId = 'com.smartisanos.notes:id/delete_insert_button').wait.exists(timeout = 5000),'Switch to note editer failed in 5s!'
			d(resourceId = 'com.smartisanos.notes:id/detail_note_editor').set_text('test content...')
			d(resourceId = 'com.smartisanos.notes:id/delete_insert_button').click.wait()
			d.sleep(1)
			d.click(900,1830)
			d.click('image.png')
			# select first pic
			d.click(150,370)
			d.click('done.png')
			assert d(resourceId = 'com.smartisanos.notes:id/detail_note_image').wait.exists(timeout = 5000),'Add pic to note failed in 5s!'
			d(resourceId = 'com.smartisanos.notes:id/send_finish_button').click.wait()
			d(resourceId = 'com.smartisanos.notes:id/send_finish_button').click.wait()
			assert d(text = '请选择操作').wait.exists(timeout = 5000),'Share selector does not pop-up in 5s!'
			d(text = '发送至新浪微博').click.wait()
			#d(text = '生成长微博').click.wait()
			#d(text = '保存到相册并继续').click.wait()
			assert d(resourceId = 'com.smartisanos.notes:id/weibo_body_view').wait.exists(timeout = 5000),'Switch to Weibo proview failed in 5s!'
			d(text = '下一步').click.wait()
			assert d(text = '发送').wait.exists(timeout = 5000),'Prepare to send weibo failed in 5s!'
			d(text = '取消').click.wait()
			d(text = '取消').click.wait()
			d(text = '列表').click.wait()
开发者ID:BowenXiao,项目名称:998_Memory,代码行数:28,代码来源:note.py

示例9: testSaveNoteAsPic

	def testSaveNoteAsPic(self):
		# Launch Note
		d.start_activity(component='com.smartisanos.notes/.NotesActivity')
		if d(text = '列表').exists:
			d(text = '列表').click.wait()
		assert d(text = '便签').wait.exists(timeout = 5000),'Launch Note failed in 5s!'
		for i in range(500):
			d(resourceId = 'com.smartisanos.notes:id/add_button').click.wait()
			assert d(resourceId = 'com.smartisanos.notes:id/delete_insert_button').wait.exists(timeout = 5000),'Switch to note editer failed in 5s!'
			d(resourceId = 'com.smartisanos.notes:id/detail_note_editor').set_text('test content...')
			d(resourceId = 'com.smartisanos.notes:id/delete_insert_button').click.wait()
			d.sleep(1)
			d.click(900,1830)
			d.click('image.png')
			# select first pic
			d.click(150,370)
			d.click('done.png')
			assert d(resourceId = 'com.smartisanos.notes:id/detail_note_image').wait.exists(timeout = 5000),'Add pic to note failed in 5s!'
			d(resourceId = 'com.smartisanos.notes:id/send_finish_button').click.wait()
			d(resourceId = 'com.smartisanos.notes:id/send_finish_button').click.wait()
			assert d(text = '请选择操作').wait.exists(timeout = 5000),'Share selector does not pop-up in 5s!'
			d(text = '以图片形式分享').click.wait()
			assert d(text = '保存图片').wait.exists(timeout = 5000),'Switch to thumbs failed in 5s!'
			d(text = '取消').click.wait()
			d(text = '列表').click.wait()
开发者ID:BowenXiao,项目名称:998_Memory,代码行数:25,代码来源:note.py

示例10: _switchLauncherSettings

	def _switchLauncherSettings(self,viewmode):
		# launch setting
		d.start_activity(component='com.android.settings/.Settings')
		assert d(text = '设置').wait.exists(timeout = 5000),'Launch settings failed in 5s!'

		# get into launcher settings
		if d(text = '单板块视图').wait.exists(timeout = 5000):
			pass
		else:
			u.selectOption('桌面设置项')
			assert d(text = '单板块视图').wait.exists(timeout = 5000),'Switch to Desktop Settings failed in 5s!'
		if viewmode == '36' or viewmode == '81':
			if d(text = '多板块视图').exists:
				d(text = VIEW_MODE[viewmode]).click.wait()
				if d(text = '设置桌面').wait.exists(timeout = 5000):
					d(text = '确定').click.wait()
			else:
				d(text = '九宫格').click.wait()
				d.sleep(3)
				if d(text = '设置桌面').wait.exists(timeout = 5000):
					d(text = '确定').click.wait()
					d.sleep(3)
				d.start_activity(component='com.android.settings/.Settings')
				assert d(text = '设置').wait.exists(timeout = 5000),'Launch settings failed in 5s!'
				d(text = VIEW_MODE[viewmode]).click.wait()
				if d(text = '设置桌面').wait.exists(timeout = 5000):
					d(text = '确定').click.wait()
		else:
			d(text = VIEW_MODE[viewmode]).click.wait()
			if d(text = '设置桌面').wait.exists(timeout = 5000):
				d(text = '确定').click.wait()
开发者ID:BowenXiao,项目名称:998_Stability,代码行数:31,代码来源:launcher.py

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

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

示例13: testLaunchMultipleApp

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

示例14: _launchEmail

	def _launchEmail(self):
		#Launch Email
		d.start_activity(component='com.android.email/.activity.Welcome')
		d.sleep(1)
		#Check if login account is needed.
		if d(text = '添加账户').exists:
			self._loginAccount()
		else:
			pass
		assert d(resourceId = 'com.android.email:id/subtitle',text = 'Exchange').wait.exists(timeout = 10000),'Launch email failed in 10s!'
开发者ID:BowenXiao,项目名称:3000_stability,代码行数:10,代码来源:email.py

示例15: _sendMessage

	def _sendMessage(self):
		#Send Message
		d(description = '发送').click.wait()
		if d(textContains = '卡 1  发送').exists:
			d(textContains = '卡 1  发送').click.wait()
		d(text = '准备发送…').wait.exists(timeout = 5000)
		d(text = '准备发送…').wait.gone(timeout = 10000)
		d.sleep(1)
		assert d(text="发送中…").wait.gone(timeout=60000), 'Send SMS failed in 60s'
		if d(textContains = '发送失败').exists:
			assert False,'Send SMS failed, please check single!'
开发者ID:BowenXiao,项目名称:998_Stability,代码行数:11,代码来源:message.py


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