本文整理汇总了Python中uiautomatorplug.android.d函数的典型用法代码示例。如果您正苦于以下问题:Python d函数的具体用法?Python d怎么用?Python d使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了d函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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!'
示例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)
示例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()
示例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()
示例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)
示例6: tearDown
def tearDown():
for i in xrange(2):
d.press('back')
if d(textContains = '退出').exists:
d(text = '确定').click()
d.press('home')
checkSystemWatchers()
示例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!')
示例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!'
示例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')
示例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
示例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
示例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')
示例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!'
示例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')
示例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')