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

Python device.click函数代码示例

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

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



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

示例1: _setScenesToAuto

 def _setScenesToAuto(self):
     commands.getoutput('adb shell input swipe 530 6 523 22')
     time.sleep(1)
     d.click(300,185)
     time.sleep(1)
     d.click(710,282)
     time.sleep(1)
开发者ID:BowenXiao,项目名称:Social_Camera_Stability_Test_Uiautomator,代码行数:7,代码来源:smilecamera.py


示例2: testTakePicture

	def testTakePicture(self):
		#Launch camera
		self._launchCamera()

		#Take pics
		before_cap = commands.getoutput('adb shell ls /sdcard/DCIM/Camera/* | grep jpg | wc -l')
		d(resourceId = 'com.android.camera2:id/shutter_button').click.wait()
		d.sleep(2)  #wait for thumbnail refresh
		after_cap = commands.getoutput('adb shell ls /sdcard/DCIM/Camera/* | grep jpg | wc -l')
		result_cap = string.atoi(after_cap) - string.atoi(before_cap)
		assert result_cap == 1,'Take picture failed, No picture in /sdcard/DCIM/Camera'

		#Check Pics
		d(resourceId = 'com.android.camera2:id/thumbnail').click.wait()
		assert d(resourceId = 'com.android.gallery3d:id/gallery_root').wait.exists(timeout = 6000),'Switch to gallery view failed in 6s!'
		
		# delete pics
		before = commands.getoutput('adb shell ls /sdcard/DCIM/Camera/* | grep jpg | wc -l')
		#(975,145) is the position of delete icon
		d.click(975,145)
		d.sleep(3)
		assert d(textContains = '确认要删除这张图片').wait.exists(timeout = 5000),"Delete confirmation pop-up failed in 5s!"
		d(text = '确认删除').click.wait()
		d.sleep(2)
		after = commands.getoutput('adb shell ls /sdcard/DCIM/Camera/* | grep jpg | wc -l')
		result = string.atoi(before) - string.atoi(after)
		assert result == 1,'Delete file failed!'
开发者ID:BowenXiao,项目名称:998_Stability,代码行数:27,代码来源:multimedia.py


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


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


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


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


示例7: testAddKeywordsToAllInGridView

 def testAddKeywordsToAllInGridView(self):
     """
     Summary: animate picture 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 add keywords option
     8.Input tag and tap DONE icon
     9.Exit socialgallery app
     """
     # Step 3
     self._longtouchscreencenter()
     # Step 4 + Step 5
     d(text = '1 selected').click()
     d(text = 'Select all').click()
     # Step 6 + Step 7
     u.setMenuOptions('Add a keyword')
     # Step 8
     d(text="Enter new keyword").set_text("New Keyword")
     d.click(1100,1660) # click 'done' icon on the keyboard.
     # confirm back to gallery
     self._longtouchscreencenter()
     d(text = '1 selected').click()
     d(text = 'Select all').click()       
     u.setMenuOptions('Add a keyword')
     assert d(text = 'New Keyword').exists
开发者ID:GuanjunXu,项目名称:Gallery23_FT_v1,代码行数:30,代码来源:gridview.py


示例8: testAnimateInGridView

 def testAnimateInGridView(self):
     """
     Summary: animate picture in gallery
     Step:
     1.Launch gallery activity 
     2.Enter Grid view
     3.Select two or more pics
     4.Tap Extra Menu
     5.Tap animate option
     6.Random select the options
     7.Tap create button
     """
     # Step 3 + Step 4
     self._longtouchscreencenter()
     d.click(200,400)
     d.click(200,800)
     # Step 4 + Step 5
     u.setMenuOptions('Animate')
     # Step 6 + Step 7
     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,代码行数:28,代码来源:gridview.py


示例9: showPopCard

 def showPopCard(self):
     time.sleep(2)
     d.click(350,100) #The center of the top action bar
     time.sleep(2)
     d.click(350,100) #Sometimes there is no response if tap here only once. Although it has poped up, tap here would do no thing for the case
     time.sleep(2)
     assert d(description = 'Share').wait.exists(timeout = 5000), 'Pop card does not display after tapping on the top bar twice'       
开发者ID:BowenXiao,项目名称:Social_Gallery_Feature_Test_Uiautomator,代码行数:7,代码来源:util.py


示例10: testAddKeywordsToAllInGridView

 def testAddKeywordsToAllInGridView(self):
     """
     Summary: animate picture 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 add keywords option
     8.Input tag and tap DONE icon
     9.Exit socialgallery app
     """
     # 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('Add keyword')
     # Step 8
     d(text="Enter new keyword").set_text("New Keyword")
     d.click(2358,1090) # click 'done' icon on the keyboard.
     # confirm back to gallery
     u.holdTheCenter()
     d(className = 'android.widget.ImageButton').click.wait()
     d(text = 'Select all').click()       
     u.setMenuOptions('Add keyword')
     assert d(text = 'New Keyword').exists
开发者ID:GuanjunXu,项目名称:Gallery_FT_BB,代码行数:30,代码来源:gridview.py


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


示例12: showPopCard

 def showPopCard(self):
     d.click(self.getSizeOfGallery()[4], self.getSizeOfGallery()[0] + 1)
     d(description = 'More options').click.wait()
     if d(text = 'View photonotes').wait.exists(timeout = 2000):
         d(text = 'View photonotes').click.wait()
     else:
         d.press('back')
     time.sleep(1)
开发者ID:GuanjunXu,项目名称:Gallery_FT_BB,代码行数:8,代码来源:util.py


示例13: setUp

    def setUp(self):
        u.clog()
        self.checkScreen()
        d.click(1380, 800)
        self.inputCode()

        time.sleep(2)
        for i in xrange(4):
            d.press("back")
        self._launch_filemanager()
开发者ID:huashuolee,项目名称:borqs_stress,代码行数:10,代码来源:max_resume.py


示例14: testWebNavigation

	def testWebNavigation(self):
		#Launch Browser
		self._launchBrowser()

		#Visite webpage
		d(resourceId = 'com.android.browser:id/url', text = '输入网址').set_text('wap.sohu.com')
		d.press('enter')
		d.expect('Web_Navigation_News.png',timeout=10, msg = 'Loading webpage failed in 10s!')

		#Click Navigation '新闻'
		d.click('Web_Navigation_News.png')
开发者ID:BowenXiao,项目名称:3000_stability,代码行数:11,代码来源:browser.py


示例15: setCameraOption

    def setCameraOption(self, optiontext, option):
        """
           ***Usage***
            To set Scenes as 'sports':
                self.setCameraOption('Scenes','sports')

                You may need use the arguements that have been defined at the top of this file
        """
        d(resourceId="com.intel.camera22:id/camera_settings").click.wait()
        while d(text=optiontext).wait.gone(timeout=2000):
            self._slideSettingListUp()
        newoptiontext = optiontext.replace(" ", "_")
        # Get the current option
        if newoptiontext not in SETTINGS_0:
            stringcated = commands.getoutput(
                "adb shell cat /data/data/com.intel.camera22/shared_prefs/com.intel.camera22_preferences_0_0.xml | grep %s"
                % DICT_OPTION_KEY[newoptiontext]
            )
            currentoption = (((stringcated.split(">"))[1]).split("<"))[0]
        else:
            stringcated = commands.getoutput(
                "adb shell cat /data/data/com.intel.camera22/shared_prefs/com.intel.camera22_preferences_0.xml | grep %s"
                % DICT_OPTION_KEY[newoptiontext]
            )
            currentoption = (((stringcated.split(">"))[1]).split("<"))[0]
        currentindex = DICT_OPTION_NAME[newoptiontext].index(currentoption)
        targetindex = DICT_OPTION_NAME[newoptiontext].index(option)
        # Settinglayout do change UI very much, so need one more logic
        settinglayout = commands.getoutput(
            "adb shell cat /data/data/com.intel.camera22/shared_prefs/com.intel.camera22_preferences_0.xml | grep pref_settings_layout_key"
        )
        if settinglayout.find("Mini") != -1:
            # Get the current option's index and compare it with the target option
            # If current option is just the target option, do nothing('pass').
            if currentindex > targetindex:
                for i in range(currentindex - targetindex):
                    self._slideOptionLeftToRight(optiontext)
                    d(resourceId="com.intel.camera22:id/camera_settings").click.wait()
            elif currentindex < targetindex:
                for i in range(targetindex - currentindex):
                    self._slideOptionRightToLeft(optiontext)
                    d(resourceId="com.intel.camera22:id/camera_settings").click.wait()
            else:
                # Neither higher nor lower than the target option, that means the current option is just the target one.
                pass
            d(resourceId="com.intel.camera22:id/mini_layout_view").click.wait()
        else:
            if currentindex != targetindex:
                d.click(
                    self._getFirstItem() + self._getOptionWidthAndHeight()[1] * targetindex,
                    self._getOptionOrdinate(optiontext),
                )
            else:
                pass
开发者ID:GuanjunXu,项目名称:util_for_BB,代码行数:54,代码来源:util.py


示例16: testSwitchView

	def testSwitchView(self):
		if d(resourceId = 'com.android.browser:id/stop').exists:
			d(resourceId = 'com.android.browser:id/newtab_btn').click.wait()
		if d(resourceId = 'com.android.browser:id/frame0').exists:
			d(resourceId = 'com.android.browser:id/switch_btn').click.wait()
		for i in range(1000):
			d(resourceId = 'com.android.browser:id/menu_btn').click.wait()
			d.click('hiden_mode.png')
			d.sleep(1)
			d(resourceId = 'com.android.browser:id/menu_btn').click.wait()
			d.click('normal_mode.png')
开发者ID:BowenXiao,项目名称:998_Memory,代码行数:11,代码来源:browser.py


示例17: testPlayBurstPictures

 def testPlayBurstPictures(self):
     """
     Steps:
          1.Launch gallery activity 
          2.Enter Full View
          3.Tap play burst icon
     """
     d.click(350,620)  
     time.sleep(7)
     d.click(324,100)
     time.sleep(1)
     assert d(resourceId = 'android:id/home').wait.exists(timeout=2000),'play fail '
开发者ID:BowenXiao,项目名称:Social_Gallery_Feature_Test_Uiautomator,代码行数:12,代码来源:burstview.py


示例18: selectPictueWhenEditBurst

 def selectPictueWhenEditBurst(self,imagesSelect):
     #Could display 5 pictures on selection bar at most, when the count of image selected bigger than 5, need swipe
     x = 70 #The abscissa of the first picture
     while imagesSelect > 0:
         d.click(x, 250)
         time.sleep(1) #Sometimes case failed if tap action is too fast
         x = x + 150 #The gap between two pictures are 150 pix
         if x > 700: #The left boundry of the fifth image, so if abscissa over than 600, need swipe
             d.swipe(650,250,1,250,steps=5)
             time.sleep(1)
             x = 70 #Reset the first abscissa
         imagesSelect = imagesSelect - 1    
开发者ID:BowenXiao,项目名称:Social_Gallery_Feature_Test_Uiautomator,代码行数:12,代码来源:util.py


示例19: testSlidePicture

 def testSlidePicture(self):
     self._clearAndPush500Pic()
     u.launchGallery()
     u.enterXView('fullview')
     d.click(550,150)
     d.click(550,150)
     time.sleep(10)
     assert d(description = 'Share').wait.exists(timeout = 5000), 'Pop card does not display after tapping on the top bar twice'       
     for i in range(2):
         for j in range(10):
             self._slideImageRtoL()
         for k in range(10):
             self._slideImageLtoR()
开发者ID:chengguopiao,项目名称:Gallery_util,代码行数:13,代码来源:stressFullView.py


示例20: testSmallPlayBurstIconOfPageflip

 def testSmallPlayBurstIconOfPageflip(self):
     """
     Summary:This case test play burst with Page flip mode in burst view.
     Precondition: There are burst pictures in sdcard
     Steps:
       1. Launch Intel gallery and enter to burst view
       2. Tap small play burst icon -> Page flip, wait some seconds to check if stopped the playing
     """ 
     self._burstMenuOption('Playback','Page flip')
     time.sleep(15)
     d.click(324,100)
     time.sleep(1)
     assert d(resourceId = 'com.intel.android.gallery3d:id/action_share').wait.exists(timeout = 3000), 'play fail'
开发者ID:BowenXiao,项目名称:Social_Gallery_Feature_Test_Uiautomator,代码行数:13,代码来源:burstview.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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