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

Python android.d函数代码示例

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

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



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

示例1: testPlayLocalVideo

 def testPlayLocalVideo(self):
     """
     launch  app store and exit
     """
     for i in xrange(5):
         d.press('right')
     assert d(text="高清播放器").exists, 'Media Explorer icon not found!'
     d(text="高清播放器").click.wait()
     assert d(resourceId='com.xiaomi.mitv.mediaexplorer:id/entry_name', text='设备').wait.exists(timeout=5000), 'launch Media Explorer failed!'
     assert d(resourceId='com.xiaomi.mitv.mediaexplorer:id/entry_name', text="视频").wait.exists(timeout=5000), 'launch Media Explorer failed!'
     d.press('right')
     d.sleep(2)
     d.press('right')
     d.sleep(2)
     d.press('down')
     d.sleep(2)
     d.press('enter')
     assert d(resourceId='com.xiaomi.mitv.mediaexplorer:id/device_label', text="移动存储设备").wait.exists(timeout=10000), 'enter Device list screen failed!'
     d.press('enter')
     assert d(className="android.widget.ListView").child(text="视频").wait.exists(timeout=10000), 'enter USB device list failed!'
     d.press('enter')
     assert d(className="android.widget.ListView").child(resourceId="com.xiaomi.mitv.mediaexplorer:id/iv_image").wait.exists(timeout=10000), 'enter USB device video list failed!'
     for i in xrange(16):
         for j in xrange(random.randint(0, 16)):
             d.press('down')
             d.sleep(1)
         for k in xrange(random.randint(0, 8)):
             d.press('up')
             d.sleep(1)
         d.press('enter')
         assert d(className="android.widget.ListView").child(resourceId="com.xiaomi.mitv.mediaexplorer:id/iv_image").wait.gone(timeout=10000), 'start to play video failed!'
         d.sleep(600)
         d.press('back')
         assert d(className="android.widget.ListView").child(resourceId="com.xiaomi.mitv.mediaexplorer:id/iv_image").wait.exists(timeout=10000), 'enter USB device video list failed!'
开发者ID:hongbinbao,项目名称:mibox_public,代码行数:34,代码来源:mediaexplorer.py


示例2: tearDown

 def tearDown(self):
     super(GalleryTest,self).tearDown()
     u.pressBack(4)
     #There will be a dialog ask user if save the edited photo when pressing back after case failed
     if d(text = 'Cancel').wait.exists(timeout = 2000):
         d(text = 'Cancel').click.wait()
     u.pressBack(4)
开发者ID:BowenXiao,项目名称:Social_Gallery_Feature_Test_Uiautomator,代码行数:7,代码来源:FullViewEdit.py


示例3: inputCode

def inputCode():
    d(resourceId="com.android.systemui:id/key1").click()
    d(resourceId="com.android.systemui:id/key2").click()
    d(resourceId="com.android.systemui:id/key3").click()
    d(resourceId="com.android.systemui:id/key4").click()
    time.sleep(2)
    d(resourceId="com.android.systemui:id/key_enter").click()
开发者ID:huashuolee,项目名称:borqs_stress,代码行数:7,代码来源:util.py


示例4: testSendMMSWithPics

	def testSendMMSWithPics(self):
		#Launch message app and enter new message screen
		self._launchAndEnterNewMsg()

		#Input receiver and text content
		self._editTestContent(MMS_RECEIVER,MMS_PICS_CONT)

		#Add pics as attachment
		d(resourceId = 'com.android.mms:id/switch_button').click.wait()
		# (120,1830) is the positon of '照片和视频'
		d.click(120,1830)
		#assert d(text = '请选择操作').wait.exists(timeout = 5000),"Trigger '照片和视频' failed in 5s!"
		#d(text = '选取照片').click.wait()
		assert d(packageName = 'com.android.gallery3d').wait.exists(timeout = 5000),'Switch to gallery view failed in 5s!'
		d.sleep(1)
		# (800,1825) is the position of '所有相册'
		d.click(800,1825)
		# select '根目录'
		d.click('MMS_Into_RootDir.png')
		d.sleep(1)
		d.click('MMS_Pics.png')
		d.sleep(1)
		# (1000,150) is the position of Done button
		d.click(1000,150)
		d.sleep(1)

		#Send MMS
		self._sendMessage()
开发者ID:BowenXiao,项目名称:998_Stability,代码行数:28,代码来源:message.py


示例5: switchBackOrFrontCamera

 def switchBackOrFrontCamera(self,status):
     d(description = FRONTBACKBUTTON_DESCR).click.wait()
     #Dictionary
     camerastatus = {'back': '0','front':'1'}  
     # Get the current camera status
     currentstatus = commands.getoutput(CAMERA_ID)
     # Confirm the current status of the user is required
     if currentstatus.find(camerastatus.get(status)) == -1:
         # draw down the menu
         commands.getoutput(DRAWDOWN_MENU)
         time.sleep(1)
         # set the camera status
         d(description = FRONTBACKBUTTON_DESCR).click.wait()
         time.sleep(3)
         # Get the current camera status
         currentstatus = commands.getoutput(CAMERA_ID)
         # check the result
         if currentstatus.find(camerastatus.get(status)) != -1:
             print ('set camera is '+status)
             return True
         else:
             print ('set camera is '+status+' fail')
             return False
     else:
         print('Current camera is ' + status)
开发者ID:chengguopiao,项目名称:Social_Camera_Stress_Test_Uiautomator,代码行数:25,代码来源:util.py


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


示例7: testDeleteMultiplePictureInGridView

 def testDeleteMultiplePictureInGridView(self):
     """
     Summary: delete the selected pics or vides
     Step:
     1.Launch gallery activity 
     2.Enter Grid view
     3.Long touch a pic or a video to select 
     4.Tap another two file to select
     5.Tap Trash icon
     6.Tap Delete option
     """
     # Step 3
     u.holdTheCenter()
     # Step 4
     d.click(700,800)
     d.click(1000,800)
     # Step 5 + Step 6
     d(className = 'android.widget.ImageButton').click.wait()
     u.setMenuOptions('Delete')
     d(text = 'Delete').click.wait()
     # confirm picture deleted.
     time.sleep(2)
     result = commands.getoutput('adb shell ls -l /sdcard/testalbum/testpictures1 | grep jpg | wc -l')
     if string.atoi(result) != 18:
         raise Exception('delete failed!')
开发者ID:chengguopiao,项目名称:Gallery_FT_BB,代码行数:25,代码来源:gridview.py


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


示例9: setUp

 def setUp(self):
     super(CameraTest,self).setUp()
     self._launchCamera()
     time.sleep(2)
     if d(text = 'OK').wait.exists(timeout = 3000):
         d(text = 'OK').click.wait()        
     sm.switchCaptureMode('burstslow')
开发者ID:BowenXiao,项目名称:Social_Camera_2.3_Stability_BB-1,代码行数:7,代码来源:burstslowcapture.py


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


示例11: _setFDFRMode

 def _setFDFRMode(self,option):
     d(resourceId = 'com.intel.camera22:id/left_menus_face_tracking').click()
     FDFRStatus = commands.getoutput('adb shell cat /data/data/com.intel.camera22/shared_prefs/com.intel.camera22_preferences_0.xml | grep pref_fdfr_key')
     if FDFRStatus.find(option) == -1:
         d(resourceId = 'com.intel.camera22:id/left_menus_face_tracking').click()
     else:
         pass
开发者ID:BowenXiao,项目名称:Social_Camera_Stress_Test_Uiautomator,代码行数:7,代码来源:util.py


示例12: testAnimateToVideoAllInGridView

 def testAnimateToVideoAllInGridView(self):
     """
     Summary: Animate all in gallery
     Step:
     1.Launch gallery activity 
     2.Enter Grid view
     3.Long touch a pic or video to select
     4.Tap select file dropdown 
     5.Tap select all option
     6.Tap extra menu
     7.Tap Convert option
     8.Select the video convert settings
     9.Tap animate button
     10.Tap Save button
     """
     # Step 3
     u.holdTheCenter()
     # Step 4 + Step 5
     d(className = 'android.widget.ImageButton').click.wait()
     d(text = 'Select all').click()
     # Step 6 + Step 7
     u.setMenuOptions('Animate')
     d(text = 'Video').click()
     d(text = 'Create').click()
     time.sleep(10)
     d(text = 'Save').click.wait()
     time.sleep(2)
     # confirm create complete
     result = commands.getoutput('adb shell ls -l /sdcard/Sharing | grep mp4 | wc -l')
     if string.atoi(result) != 1:
         raise Exception('animated failed')
开发者ID:GuanjunXu,项目名称:Gallery_FT_BB,代码行数:31,代码来源:gridview.py


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


示例14: testAnimateToGIFAllInGridView

 def testAnimateToGIFAllInGridView(self):
     """
     Summary: Animate all in gallery
     Step:
     1.Launch gallery activity 
     2.Enter Grid view
     3.Long touch a pic or video to select
     4.Tap select file dropdown 
     5.Tap select all option
     6.Tap extra menu
     7.Tap Convert option
     8.Select the GIF convert settings
     9.Tap animate button
     10.Tap Save button
     """
     # Step 3
     self._longtouchscreencenter()
     # Step 4 + Step 5
     d(text = '1 selected').click()
     d(text = 'Select all').click()
     # Step 6 + Step 7
     u.setMenuOptions('Animate')
     d(text = 'Animated GIF').click()
     d(text = 'Create').click()
     time.sleep(2)
     d(text = 'Save').click.wait()
     time.sleep(2)
     # confirm create complete
     result = commands.getoutput('adb shell ls -l /sdcard/Sharing | grep gif | wc -l')
     if string.atoi(result) != 1:
         self.fail('animated failed')
开发者ID:GuanjunXu,项目名称:Gallery23_FT_v1,代码行数:31,代码来源:gridview.py


示例15: testPlayVideoOnline

 def testPlayVideoOnline(self):
     #d.start_activity('--activity-clear-task', component='com.duokan.duokantv/.MainActivity')
     assert d(text="在线影视").exists, 'Online Video icon not found!'
     d(text="在线影视").sibling(className='android.view.View').click.wait()
     #menu_hot_highlight_focus_png =  os.path.join(PIC_DIR, 'menu_hot_highlight_focus.png')
     #menu_hot_highlight_nofocus_png  =  os.path.join(PIC_DIR, 'menu_hot_highlight_nofocus.png')
     #preview_shoucang_png =  os.path.join(PIC_DIR, 'video_preview_sub_shoucang.png')
     #preview_pinglun_png =  os.path.join(PIC_DIR, 'video_preview_sub_pinglun.png')
     if  d.find('menu_hot_highlight_focus.png', timeout=30) :
         d.press('down')
         d.sleep(2)
         d.press('enter') 
     elif  d.find('menu_hot_highlight_nofocus.png', timeout=30):
         d.press('enter')
     else:
         assert False, 'launch video failed'  
     d.expect('video_preview_sub_shoucang.png', timeout=30)
     d.sleep(2)
     d.press('enter')
     assert d(resourceId='com.duokan.duokantv:id/main_frame').wait.exists(timeout=30000), 'video not start!'
     #assert not d.find('video_preview_sub_shoucang.png', timeout=30), 'video not start!'
     d.sleep(120)
     d.press('back')
     d.expect('video_preview_sub_shoucang.png', timeout=30)
     d.press('back')
开发者ID:hongbinbao,项目名称:mibox_public,代码行数:25,代码来源:tests.py


示例16: _recognizeAFace

 def _recognizeAFace(self):
     #Face recognize
     u.tapOnCenter() #Tap on the face
     time.sleep(2)
     u.tapOnCenter() #Tap on the contact on the screen center
     if d(text = 'Crop').wait.exists(timeout = 2000):
         d(text = 'Crop').click.wait()
开发者ID:BowenXiao,项目名称:Social_Gallery_Feature_Test_Uiautomator,代码行数:7,代码来源:FullViewFDFR.py


示例17: _setpictureas

 def _setpictureas(self,option):
     '''
     if option == 'Wallpaper':
         d(text = 'com.intel.android.gallery3d').click()
     else:
     '''
     d(text = option).click()
开发者ID:GuanjunXu,项目名称:Gallery_FT_BB,代码行数:7,代码来源:gridview.py


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


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


示例20: launchGallery

 def launchGallery(self):
     #d.start_activity(component = ACTIVITY_NAME)
     subprocess.Popen('adb shell am start -n '+ACTIVITY_NAME, stdout=subprocess.PIPE, shell=True)
     time.sleep(3)
     if d(text='Camera Roll').wait.exists(timeout=3000):
         d(text = 'Camera Roll').click.wait()
         d(text = 'Albums').click.wait()
     time.sleep(1) #Switch filter may take a few seconds
开发者ID:chengguopiao,项目名称:Gallery_FT_BB,代码行数:8,代码来源:util.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python device.click函数代码示例发布时间:2022-05-27
下一篇:
Python myDevice.d函数代码示例发布时间: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