• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python device.start_activity函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

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


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


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

	def testSetTheme(self):
		u.launchSettings()
		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 theme in THEME_LIST:
#			if theme == '经典':
#				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()
#				if d(text = '桌面主题').wait.exists(timeout = 5000):
#					continue
#				else:
#					assert d(resourceId = 'com.smartisanos.launcher:id/glview').wait.exists(timeout = 15000), 'Switch to launcher failed in 15s!'
#					
			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.sleep(1)
开发者ID:BowenXiao,项目名称:998_Stability,代码行数:31,代码来源:setting.py


示例5: setUp

	def setUp(self):
		u.setUp()
		#Launch music player
		d.start_activity(component='com.smartisanos.music/.activities.MusicMain')
		assert d(resourceId = 'com.smartisanos.music:id/ib_right').wait.exists(timeout=5000),'Launch music player failed in 5s!'
		d(text = '歌曲',resourceId = 'com.smartisanos.music:id/rb_song').click.wait()
		assert d(resourceId = 'com.smartisanos.music:id/tv_title',text = '歌曲').wait.exists(timeout = 5000),'Switch to music list failed in 5s!'
开发者ID:BowenXiao,项目名称:998_Memory,代码行数:7,代码来源:music.py


示例6: testTurnOnOffWifi

	def testTurnOnOffWifi(self):
		'''
		before running, keep wi-fi connected.
		'''
		#Launch Setting
		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 WIFI failed in 5s!'
		if d(text = '要查看可用网络,请打开无线网络').exists:
			print 'Current wifi status: Off'
			d(resourceId = 'com.android.settings:id/item_switch').swipe.right(steps = 5)
			d(text = '已连接').wait.exists(timeout = 15000)
		else:
			print 'Current wifi status: On'
			d(text = '已连接').wait.exists(timeout = 15000)
		for i in range(1000):
			#Turn off wifi
			d(resourceId = 'com.android.settings:id/item_switch').swipe.left(steps = 5)
			assert d(text = '要查看可用网络,请打开无线网络').wait.exists(timeout = 15000),'Turn off wifi failed in 5s!'
			#Turn on wifi
			d(resourceId = 'com.android.settings:id/item_switch').swipe.right(steps = 5)
			assert d(text = '已连接').wait.exists(timeout = 15000),'Turn on wifi failed in 5s!(UI)'
			assert self._getWifiStatus(),'Turn on wifi failed in 5s!(Dumpsys)'
开发者ID:BowenXiao,项目名称:998_Memory,代码行数:25,代码来源:setting.py


示例7: launchGallery

 def launchGallery(self):
     d.start_activity(component = ACTIVITY_NAME)
     if d(text = 'Camera Roll').wait.exists(timeout = 3000):
         d(text = 'Camera Roll').click.wait()
         d(text = 'Albums').click.wait()
         self.setMenuOptions('Sort by name, A-Z')
     time.sleep(1) #Switch filter may take a few seconds
开发者ID:GuanjunXu,项目名称:Gallery_FT_BB,代码行数:7,代码来源:util.py


示例8: testWifiOpenAndClose

 def testWifiOpenAndClose(self):
     d.start_activity('--activity-clear-task', component='com.android.settings/.Settings')
     d(text="无线和网络").wait.exists(timeout=2000)
     #d(className="android.widget.ListView", resourceId="android:id/list").child(text='WLAN').click.wait()
     #d(text="WLAN").click.wait()
     d.press('enter')
     d(resourceId='android:id/action_bar').child(text='WLAN').wait.exists(timeout=3000)
     if d(className='android.widget.Switch', text='打开').exists:
         d.press('right')
         d.sleep(2)
         d.press('up')
         d.sleep(2)
         for i in xrange(10):
             d.press('enter')
             assert d(resourceId='android:id/action_bar').child(text='关闭').wait.exists(timeout=3000), 'wifi close failed!'
             d.press('enter')
             assert d(resourceId='android:id/action_bar').child(text='打开').wait.exists(timeout=3000), 'wifi open failed!' 
             assert d(resourceId='android:id/list').child(text='已连接').wait.exists(timeout=20000), 'wifi connect failed!' 
     elif d(className='android.widget.Switch', text='关闭').exists:
         d.press('right')
         d.sleep(2)
         d.press('up')
         d.sleep(2)
         for i in xrange(10):           
             d.press('enter')
             assert d(resourceId='android:id/action_bar').child(text='打开').wait.exists(timeout=3000), 'wifi close failed!'
             assert d(resourceId='android:id/list').child(text='已连接').wait.exists(timeout=20000), 'wifi connect failed!' 
             d.press('enter')
             assert d(resourceId='android:id/action_bar').child(text='打开').wait.exists(timeout=3000), 'wifi open failed!' 
开发者ID:hongbinbao,项目名称:mibox_public,代码行数:29,代码来源:tests.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: 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


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


示例12: testSwitchLanguage

	def testSwitchLanguage(self):
		#language_dir = {'English':'Language',
		#				'中文 (简体)':'语言',
		#				'中文 (繁體)':'語言'
		#				}
		d.start_activity(component='com.android.settings/.Settings')
		assert d(text = '设置').wait.exists(timeout = 5000),'Launch settings failed in 5s!'

		u.selectOption('语言和键盘')
		assert d(text = '语言').wait.exists(timeout = 5000),'Switch to language setting failed in 5s!'
		for i in range(50):
			d(text = '语言').click.wait()
			assert d(resourceId = 'smartisanos:id/tv_title',text = '语言').wait.exists(timeout = 5000),'Get into language setting failed in 5s!'
			# switch to traditional chinese
			d(text = '中文 (繁體)').click.wait()
			assert d(text = '語言').wait.exists(timeout = 5000),'Switch to Traditional Chinese failed in 5s!'
			d(text = '語言').click.wait()
			assert d(resourceId = 'smartisanos:id/tv_title',text = '語言').wait.exists(timeout = 5000),'Get into language setting failed in 5s!'
			# switch to english
			d(text = 'English').click.wait()
			assert d(text = 'Language').wait.exists(timeout = 5000),'Switch to English failed in 5s!'
			d(text = 'Language').click.wait()
			assert d(resourceId = 'smartisanos:id/tv_title',text = 'Language').wait.exists(timeout = 5000),'Get into language setting failed in 5s!'
			# switch to simple chinese
			d(text = '中文 (简体)').click.wait()
			assert d(text = '语言').wait.exists(timeout = 5000),'Switch to English failed in 5s!'
开发者ID:BowenXiao,项目名称:998_Memory,代码行数:26,代码来源:launcher.py


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


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


示例15: _launchCamera

 def _launchCamera(self):
     d.start_activity(component = ACTIVITY_NAME)
     #When it is the first time to launch camera there will be a dialog to ask user 'remember location', so need to check
     if d(text = 'OK').wait.exists(timeout = 3000):
         d(text = 'OK').click.wait() 
     if d(text = 'Skip').wait.exists(timeout = 3000):
         d(text = 'Skip').click.wait()          
     assert d(resourceId = 'com.intel.camera22:id/mode_button').wait.exists(timeout = 3000), 'Launch camera failed in 3s'
开发者ID:BowenXiao,项目名称:Social_Camera_2.3_FT_BB-1,代码行数:8,代码来源:hdrcapture.py


示例16: testSwitchView

	def testSwitchView(self):
		#Launch calander
		d.start_activity(component='com.android.calendar/.AllInOneActivity')
		assert d(text='今天').wait.exists(timeout = 5000),'Launch calendar failed in 5s!'

		view_list = ['日','周','月']
		for i in range(500):
			view = random.choice(view_list)
			d(text = view).click()
开发者ID:BowenXiao,项目名称:998_Memory,代码行数:9,代码来源:calander.py


示例17: _launchEmail

	def _launchEmail(self):
		#Launch Email
		d.start_activity(component='com.android.email/.activity.Welcome')
		#Check if login account is needed.
		if d(text = '添加账户').wait.exists(timeout = 5000):
			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,项目名称:998_Memory,代码行数:9,代码来源:email.py


示例18: testSwitchView

	def testSwitchView(self):
		#Launch camera
		d.start_activity(component = 'com.smartisanos.appstore/.AppStoreActivity')
		assert d(resourceId = 'com.smartisanos.appstore:id/main_header').wait.exists(timeout = 5000), 'Launch appstore failed in 5s!'

		view_list = ['推荐','榜单','分类','搜索','应用管理']
		for i in range(500):
			view = random.choice(view_list)
			d(text = view).click()
开发者ID:BowenXiao,项目名称:998_Memory,代码行数:9,代码来源:appstore.py


示例19: _launchCamera

 def _launchCamera(self):
     d.start_activity(component=ACTIVITY_NAME)
     # When it is the first time to launch camera there will be a dialog to ask user 'remember location', so need to check
     try:
         assert d(text="OK").wait.exists(timeout=2000)
         d(text="OK").click.wait()
     except:
         pass
     assert d(resourceId="com.intel.camera22:id/mode_button").wait.exists(timeout=3000), "Launch camera failed in 3s"
开发者ID:BowenXiao,项目名称:Social_Camera_FT_Test_Uiautomator,代码行数:9,代码来源:videocapture.py


示例20: testReadSMS

	def testReadSMS(self):
		# insert SMS
		self._insertSMS(SMS_SENDER_INSERT,SMS_CONT_INSERT)
		#Launch message
		d.start_activity(component='com.android.mms/.ui.ConversationList')
		assert d(text = '短信').wait.exists(timeout = 5000),'Launch message failed in 5s!'

		#Read a SMS
		d(text = SMS_CONT).click.wait()
		assert d(resourceId = 'com.android.mms:id/text_view',text = SMS_CONT).wait.exists(timeout = 5000),'There is no text view, read SMS failed is 5s!'
开发者ID:BowenXiao,项目名称:998_Stability,代码行数:10,代码来源:message.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python device.swipe函数代码示例发布时间:2022-05-27
下一篇:
Python device.sleep函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap