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

Python uiautomator.d函数代码示例

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

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



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

示例1: testSendMMSWithVideo

    def testSendMMSWithVideo(self):
        """
        Summary:testSendMMSWithVideo: Send a mms with video attachment.
        #Init condition:Clear up all messagebox
        Steps:1. Open Messages app
              2. Touch Compose button
              3. Input deliver number and content
              4. Touch Attach button
              5. Select Gallery
              6. Enter 001 folder, select a video
              7. Touch Send button
              8. Delete all messages
              9. Exit Messages app
        """
        #step1
        commands.getoutput('adb shell am start ' + self.runComponent)
        assert d(text = 'Messaging').wait.exists(), 'Message launch failed'

        self._clearMessage()

        #step2,3,4,5,6
        commands.getoutput('adb shell am start -a android.intent.action.SEND -t video/* --es address ' + MESSAGE_RECEIVER_NUMBER + ' --es sms_body ' + SEND_MESSAGE_CONTENT + ' --eu android.intent.extra.STREAM file:///mnt/sdcard/001/300K/Video.3gp -n com.android.mms/.ui.ComposeMessageActivity')
        assert d(text = 'View').wait.exists(), 'message create failed'

        #step7
        d(description = 'Send MMS').click.wait()
        assert d(textContains = ':', className = 'android.widget.TextView').wait.exists(timeout = 60000), 'Message send failed'

        #step8
        d.press('back')
        self._clearMessage()
开发者ID:zuodapeng,项目名称:falcon,代码行数:31,代码来源:message.py


示例2: testSendSMS

    def testSendSMS(self):
        """
        Summary:testSendSMS: Send a SMS.
        #Init condition:Clear up all messagebox
        Steps:1. Open Messages app
              2. Touch Compose button
              3. Input deliver number and content
              4. Touch Send button
              5. Delete all messages
              6. Exit Messages app
        """
        #step1
        commands.getoutput('adb shell am start ' + self.runComponent)
        assert d(text = 'Messaging').wait.exists(), 'Message launch failed'

        self._clearMessage()

        #step2,3
        commands.getoutput('adb shell am start -a android.intent.action.SEND  --es address ' + MESSAGE_RECEIVER_NUMBER + ' --es sms_body ' + SEND_MESSAGE_CONTENT + ' -n com.android.mms/.ui.ComposeMessageActivity')
        time.sleep(2)

        #step4
        d(description = 'Send').click.wait()
        assert d(textContains = ':', className = 'android.widget.TextView').wait.exists(timeout = 35000), 'Message send failed'

        #step5
        d.press('back')
        self._clearMessage()
开发者ID:zuodapeng,项目名称:falcon,代码行数:28,代码来源:message.py


示例3: testOpenMmsWithImage

    def testOpenMmsWithImage(self):
        """
        Summary:testOpenMmsWithVideo:open a mms with video
        #Init condition:Clear up all messagebox
        Precondition:
              1.There is a 600kb audio file in sdcard

        Steps:1.Launch message app
              2.Open a mms with audio 
              3.Delete message
              4.Exit message app      
        """
        #step1
        commands.getoutput('adb shell am start ' + self.runComponent)
        assert d(text = 'Messaging').wait.exists(), 'Message launch failed'

        self._clearMessage()

        commands.getoutput('adb shell am start -a android.intent.action.SEND -t image/* --es address ' + MESSAGE_RECEIVER_NUMBER + ' --es sms_body ' + SEND_MESSAGE_CONTENT + ' --eu android.intent.extra.STREAM file:///mnt/sdcard/001/300K/Picture.jpg -n com.android.mms/.ui.ComposeMessageActivity')
        time.sleep(2)
        d.press('back')

        #step2
        d(textContains = 'subject').click.wait()
        assert d(description = 'Send MMS').wait.exists(), 'MMS open failed'

        #step3
        d.press('back')
        d.press('back')

        self._clearMessage()
开发者ID:zuodapeng,项目名称:falcon,代码行数:31,代码来源:message.py


示例4: testOpenSms

    def testOpenSms(self):
        """
        Summary:testOpenSMS:open a sms
        #Init condition:Clear up all messagebox
        Precondition:
              1.Prepare a received sms.
        
        Steps:1.Launch Messages app
              2.Open a sms
              3.Delete message
              4.Exit message app
              
        """
        #step1
        commands.getoutput('adb shell am start ' + self.runComponent)
        assert d(text = 'Messaging').wait.exists(), 'Message launch failed'

        self._clearMessage()

        commands.getoutput('adb shell am start -a android.intent.action.SEND  --es address ' + MESSAGE_RECEIVER_NUMBER + ' --es sms_body ' + SEND_MESSAGE_CONTENT + ' -n com.android.mms/.ui.ComposeMessageActivity')
        time.sleep(2)
        d.press('back')

        #step2
        d(textContains = 'test').click.wait()
        assert d(description = 'Send').wait.exists(), 'SMS open failed'

        #step3
        d.press('back')
        d.press('back')
        self._clearMessage()
开发者ID:zuodapeng,项目名称:falcon,代码行数:31,代码来源:message.py


示例5: onClickSwitch

def onClickSwitch(textName):
	if(d(className="android.widget.ListView", resourceId="com.android.settings:id/listviewApp").child_by_text(textName, className="android.widget.RelativeLayout").child(className="android.widget.Switch", text="OFF").exists):
		d(className="android.widget.ListView", resourceId="com.android.settings:id/listviewApp").child_by_text(textName, className="android.widget.RelativeLayout").child(className="android.widget.Switch").click()
		return True
	else:
		print(textName +"Already ONN")
		return False
开发者ID:Rockyzsu,项目名称:Python,代码行数:7,代码来源:newNsaver.py


示例6: operation_usage

def operation_usage():

    #d.press.home()
    result=d(textContains=u'设置').wait.exists(timeout=10000)
    #单位是毫秒, 如果timeout还没有找到,就返回false
    print("next")
    if result:
        print("You press setting")
    else:
        print("You don't touch any thing")


    '''
    if d(text=u'设置').exists:
        d(text='WLAN').click()
    else:
        print("move")
    '''

    # d(text=u'显示').click()
    #支持unicode

    d(scrollable=True).scroll(steps=3)

    time.sleep(3)
    #d.open.notification()
    d.wait.idle()
    print("waiting for idle")
开发者ID:Rockyzsu,项目名称:base_function,代码行数:28,代码来源:uiautomator_usage.py


示例7: firstdo

    def firstdo(self):
        '''
        app 进入输入手机号界面前的准备操作
        :return:
        '''
        #deviceinfo.startApp('com.coohuaclient/.ui.activity.SplashActivity')
        time.sleep(5)
        try:
            #向右滑动解锁
            # d(resourceId='com.coohuaclient:id/tv_slide_horizontal_guide').drag.to(resourceId='com.coohuaclient:id/view_hand',steps=100)
            # textclick('点我左划试试')
            # d(resourceId='com.coohuaclient:id/tv_slide_horizontal_guide').drag.to(resourceId='com.coohuaclient:id/tv_left_cost',steps=100)
            # d(resourceId='com.coohuaclient:id/btn_click_me').click()
            # #上划
            # d(resourceId='com.coohuaclient:id/wave_circle_up').drag.to(d.info['displaySizeDpX']/2,100,steps=50)
            #d(resourceId='com.coohuaclient:id/wave_circle_down').drag.to(d.info['displaySizeDpX']/2,d.info['displaySizeDpY'],steps=50)

            #跳过
            d(resourceId='com.coohuaclient:id/tv_date').click()
            d(resourceId='com.coohuaclient:id/btn_register').click()
        except:
            print Exception

        try:
            textclick(u'注册')
        except:
            print Exception
开发者ID:he1chenglong,项目名称:uiautomator,代码行数:27,代码来源:kuhuaapp.py


示例8: inputCode

 def inputCode(self):
     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,代码来源:lock_unlock.py


示例9: loop_sdn

def loop_sdn():
	if d(text="Service Dialing Numbers").wait.exists():
		d(text="Service Dialing Numbers").click()
		d.press("back")
	else:
		c.common.log("text=Service Dialing Numbers未找到,保存截图")
		c.common.save_fail_img()
开发者ID:Renzhiai,项目名称:rza-s-python,代码行数:7,代码来源:028.call.py


示例10: drag_txt1_to_txt2

def drag_txt1_to_txt2(txt1,txt2):
	"""Drag the ui object to another ui object (center).

	Example:
	| drag txt1 to txt2| txt1 | txt2 | #drag txt1 to txt2 | 
	"""
	d(text=txt1).drag.to(text=txt2, steps=50)
开发者ID:Jmeima,项目名称:uiautomatorLibrary_for_robotframework,代码行数:7,代码来源:gestures.py


示例11: runtest

def runtest(serialno, loop):
    print "liu: in runtest"
    if serialno:
        print "liu: in serialno"
        from uiautomator import Device
        d = Device(serialno)
    else:
        print "liu: in else"
        from uiautomator import device as d

    print "总共 %d 次循环" %loop

    for i in range(1, loop+1):
        print "第 %d 次循环" %i
        d.screen.on()
        d.press.home()
        d(description="Apps").click()
        d(text="Basemark ES2 Taiji Free").click()
        time.sleep(2)

        if d(text="Agree").exists:
            d(text="Agree").click()

        d(text="Run Benchmark").click()
        while not d(text="FRAMES PER SECOND").exists:
            time.sleep(2)
        else:
            d.screenshot("%s/screenshot/%d_taiji_%s.png"\
                    %(sys.path[0], i, now.strftime(ISOFORMAT)))

        d.press.home()
        i += 1

    print "***** test end ********"
开发者ID:liushui312,项目名称:uiautomator,代码行数:34,代码来源:taiji.py


示例12: drag_txt_to_xy

def drag_txt_to_xy(txt,x,y,steps=100):
	"""Drag the ui object to point (x, y).

	Example:
	| drag txt1 to xy| Music | 250 | 300 | 
	"""
	d(text=txt).drag.to(x, y, steps)
开发者ID:Jmeima,项目名称:uiautomatorLibrary_for_robotframework,代码行数:7,代码来源:gestures.py


示例13: setselftimerstatus

    	def setselftimerstatus(self,status):
	commands.getoutput('adb shell input swipe 530 6 523 22')
	time.sleep(1)
	d(description=Setting_description).click.wait()
	commands.getoutput('adb shell input swipe 670 165 78 165')
	commands.getoutput('adb shell input tap 679 182')
	time.sleep(1)
        if status == '10':
            commands.getoutput('adb shell input tap 414 294')
        elif status == '5':
            commands.getoutput('adb shell input tap 295 294')
        elif status == '3':
            commands.getoutput('adb shell input tap 181 294')
        elif status == '0':
            commands.getoutput('adb shell input tap 54 294')
	time.sleep(3)
        state = commands.getoutput(SelfTimer_STATE)
        statevalue = state.find(status)
	assert statevalue != -1	

    	def launchcamera(self):
	d(description='Apps').click.wait()
        while not d.exists(text='Camera'):
	d().swipe.right()
            time.sleep(3)
        d(text='Camera').click.wait()
        d(description="Shutter button").wait.exists(timeout=3000)
        time.sleep(5)
开发者ID:chengguopiao,项目名称:test,代码行数:28,代码来源:singlecamera.py


示例14: runtest

def runtest(serialno, loop, videoname):
    if serialno:
        from uiautomator import Device
        d = Device(serialno)
    else:
        from uiautomator import device as d

    print "总共 %d 次循环" %loop

    for i in range(1, loop+1):
        print "第 %d 次循环" %i
        d.screen.on()
        d.press.home()
        removeRecentList(d, "File Manager")
        d(description="Apps").click()
        d(text="File Manager").click()
        time.sleep(0.5)
        d(text="sdcard").click()
        d(text="Movies").click()
        d(text=videoname).click()
        for i in range(1,20):
            x = random.randint(100, 600)
            d.click(x, 80)
            time.sleep(3)
        
        d.press.back()
        d.press.home()
        i += 1

    print "***** test end ********"
开发者ID:liushui312,项目名称:uiautomator,代码行数:30,代码来源:play_single_video.py


示例15: __pressback

	def __pressback(self,c):
		for i in range(c):
			d.press.back()
			if d(text="退出").exists:
				d(text="确定",className="android.widget.Button").click()
				time.sleep(3)
				break
开发者ID:raullf,项目名称:CJTestScripts,代码行数:7,代码来源:PerformanceTest.py


示例16: setsencestatus

    def setsencestatus(self,status):
	commands.getoutput('adb shell input swipe 530 6 523 22')
	time.sleep(1)
	d(description=Setting_description).click.wait()
	commands.getoutput('adb shell input tap 531 165')
	time.sleep(1)
	if status == 'auto':
		commands.getoutput('adb shell input swipe 660 285 66 285')
		commands.getoutput('adb shell input tap 657 294')
	elif status == 'sports':
		commands.getoutput('adb shell input swipe 660 285 66 285')
		commands.getoutput('adb shell input tap 534 290')
        elif status == 'night':
		commands.getoutput('adb shell input tap 643 290')
        elif status == 'landscape':
		commands.getoutput('adb shell input tap 512 290')
        elif status == 'portrait':
		commands.getoutput('adb shell input tap 385 290')
        elif status == 'night-portrait':
		commands.getoutput('adb shell input tap 285 290')
        elif status == 'barcode':
		commands.getoutput('adb shell input tap 177 290')
        elif status == 'fireworks':
		commands.getoutput('adb shell input tap 58 290')
	time.sleep(3)
        state = commands.getoutput(Scene_STATE)
        statevalue = state.find(status)
	assert statevalue != -1
开发者ID:chengguopiao,项目名称:test,代码行数:28,代码来源:singlecamera.py


示例17: __launchApp

	def __launchApp(self):
		#find app
		self.__findApp()
		# launch app
		d(text="财经杂志",packageName="com.android.launcher").click()
		time.sleep(3)
		assert d(className="android.widget.ImageView", \
			packageName="com.caijing")[0]
开发者ID:raullf,项目名称:CJTestScripts,代码行数:8,代码来源:PerformanceTest.py


示例18: removeRecentList

def removeRecentList(d, app_desc):
    d.press.home()
    d.press.recent()
    time.sleep(1)
    if d(description=app_desc).exists:
        d(description=app_desc).long_click()
        d(text="Remove from list").click()
    d.press.home()
开发者ID:liushui312,项目名称:uiautomator,代码行数:8,代码来源:taiji.py


示例19: test_run_calculator

 def test_run_calculator(self):
     print("Run Calculator")
     d.press.back()
     time.sleep(2)
     d.press.home()
     time.sleep(2)
     d(description="Apps",className="android.widget.TextView").click()
     time.sleep(2)
开发者ID:fxlysm,项目名称:PYAndroid_Test,代码行数:8,代码来源:calculatorTestCase.py


示例20: swipe_up_className

def swipe_up_className(className,timeout=50):
	"""Swipe up on the given Resource Id or the given timeout expires.

	Example:
	| swipe up rscId| com.nokia.z:id/secondTopMostLayout | 15000 |
	"""
	if d(className=className).wait.exists(timeout=timeout):
		d(className=className).swipe.up()
开发者ID:Jmeima,项目名称:uiautomatorLibrary_for_robotframework,代码行数:8,代码来源:gestures.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python uiautomator.Adb类代码示例发布时间:2022-05-27
下一篇:
Python ui.infoWindow函数代码示例发布时间: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