当前位置: 首页>>代码示例>>Python>>正文


Python MultiAction.add方法代码示例

本文整理汇总了Python中appium.webdriver.common.multi_action.MultiAction.add方法的典型用法代码示例。如果您正苦于以下问题:Python MultiAction.add方法的具体用法?Python MultiAction.add怎么用?Python MultiAction.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在appium.webdriver.common.multi_action.MultiAction的用法示例。


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

示例1: tap

# 需要导入模块: from appium.webdriver.common.multi_action import MultiAction [as 别名]
# 或者: from appium.webdriver.common.multi_action.MultiAction import add [as 别名]
    def tap(self, positions, duration=None):
        """Taps on an particular place with up to five fingers, holding for a
        certain time

        :Args:
         - positions - an array of tuples representing the x/y coordinates of
         the fingers to tap. Length can be up to five.
         - duration - (optional) length of time to tap, in ms

        :Usage:
            driver.tap([(100, 20), (100, 60), (100, 100)], 500)
        """
        if len(positions) == 1:
            action = TouchAction(self)
            x = positions[0][0]
            y = positions[0][1]
            if duration:
                action.long_press(x=x, y=y, duration=duration).release()
            else:
                action.tap(x=x, y=y)
            action.perform()
        else:
            ma = MultiAction(self)
            for position in positions:
                x = position[0]
                y = position[1]
                action = TouchAction(self)
                if duration:
                    action.long_press(x=x, y=y, duration=duration).release()
                else:
                    action.press(x=x, y=y).release()
                ma.add(action)

            ma.perform()
        return self
开发者ID:ZezHok,项目名称:MyFirsAutoTest,代码行数:37,代码来源:webdriver.py

示例2: test_parallel_actions

# 需要导入模块: from appium.webdriver.common.multi_action import MultiAction [as 别名]
# 或者: from appium.webdriver.common.multi_action.MultiAction import add [as 别名]
    def test_parallel_actions(self):
        el1 = self.driver.find_element_by_name('Content')
        el2 = self.driver.find_element_by_name('Animation')
        self.driver.scroll(el1, el2)

        el = self.driver.find_element_by_name('Views')
        action = TouchAction(self.driver)
        action.tap(el).perform()

        el = self.driver.find_element_by_name('Expandable Lists')
        # simulate a swipe/scroll
        action.press(el).move_to(x=100, y=-1000).release().perform()

        el = self.driver.find_element_by_name('Splitting Touches across Views')
        action.tap(el).perform()

        els = self.driver.find_elements_by_class_name('android.widget.ListView')
        a1 = TouchAction()
        a1.press(els[0]) \
            .move_to(x=10, y=0).move_to(x=10, y=-75).move_to(x=10, y=-600).release()

        a2 = TouchAction()
        a2.press(els[1]) \
            .move_to(x=10, y=10).move_to(x=10, y=-300).move_to(x=10, y=-600).release()

        ma = MultiAction(self.driver, els[0])
        ma.add(a1, a2)
        ma.perform();
开发者ID:vigossjjj,项目名称:python-client,代码行数:30,代码来源:multi_action_tests.py

示例3: MultiActionTests

# 需要导入模块: from appium.webdriver.common.multi_action import MultiAction [as 别名]
# 或者: from appium.webdriver.common.multi_action.MultiAction import add [as 别名]
class MultiActionTests(unittest.TestCase):
    def setUp(self):
        self._multi_action = MultiAction(DriverStub())

    def test_json(self):
        self.maxDiff = None
        json = {
            'actions': [
                [
                    {'action': 'press', 'options': {'x': None, 'y': None, 'element': 1}},
                    {'action': 'moveTo', 'options': {'x': 10, 'y': 20}},
                    {'action': 'release', 'options': {}}
                ],
                [
                    {'action': 'press', 'options': {'x': 11, 'y': 30, 'element': 5}},
                    {'action': 'moveTo', 'options': {'x': 12, 'y': -300}},
                    {'action': 'release', 'options': {}}
                ]
            ],
            'elementId': 0
        }
        t1 = TouchAction(DriverStub()).press(ElementStub(1)).move_to(x=10, y=20).release()
        t2 = TouchAction(DriverStub()).press(ElementStub(5), 11, 30).move_to(x=12, y=-300).release()
        self._multi_action.add(t1, t2)
        self.assertEqual(json, self._multi_action.json_wire_gestures)
开发者ID:0x1mason,项目名称:python-client,代码行数:27,代码来源:multi_action_tests.py

示例4: test_zoom_image

# 需要导入模块: from appium.webdriver.common.multi_action import MultiAction [as 别名]
# 或者: from appium.webdriver.common.multi_action.MultiAction import add [as 别名]
    def test_zoom_image(self):
        # 查找元素 操作  校验
        self.driver.find_element_by_xpath("//UIAButton[@label='Gesture']").click()
        self.driver.find_element_by_accessibility_id("Image (Zoom and Pinch)").click()

        image = self.driver.find_element_by_accessibility_id("imageScrollView")
        location = image.location

        # 获取image的坐标,为(20,90)
        print location
        x = location["x"]
        y = location["y"]
        print x
        print y

        # 获取image的宽和高,分别为300,300
        size = image.size
        print size

        a1 = TouchAction()
        a1.press(x=x, y=y).move_to(x=x, y=y+x).release()
        a2 = TouchAction()
        a2.press(x=x, y=y).move_to(x=x, y=y-x).release()

        # MultiAction(self.driver).add(a1, a2).perform()这个写法是错误的,必须分3行,不能合并到1行!

        multi_touch = MultiAction(self.driver)
        multi_touch.add(a1, a2)
        multi_touch.perform()
        sleep(3)
开发者ID:cutebabyhua,项目名称:appium_ios,代码行数:32,代码来源:l6_personal_zoom_image.py

示例5: test_services_map_multi_touch

# 需要导入模块: from appium.webdriver.common.multi_action import MultiAction [as 别名]
# 或者: from appium.webdriver.common.multi_action.MultiAction import add [as 别名]
 def test_services_map_multi_touch(self):
     enter_menu(self)
     self.driver.find_element_by_android_uiautomator('textContains("Map")').click()
     el = self.driver.find_element_by_accessibility_id('Google Map')
     els = el.find_elements_by_class_name('android.view.View')
     if len(els) > 3:
         action0 = TouchAction().tap(els[0])
         action1 = TouchAction().tap(els[1])
         action2 = TouchAction().tap(els[2])
         ma = MultiAction(self.driver, els[0])
         ma.add(action0, action1, action2)
         ma.perform()
     self.driver.back()
     self.driver.back()
开发者ID:jkondrat,项目名称:org.rescue.RefugeeInfoApp,代码行数:16,代码来源:android_country_city_selected.py

示例6: test_by_multiaction

# 需要导入模块: from appium.webdriver.common.multi_action import MultiAction [as 别名]
# 或者: from appium.webdriver.common.multi_action.MultiAction import add [as 别名]
	def test_by_multiaction(self):
		print "By multiaction"
		self.method_name = sys._getframe().f_code.co_name
		# self.driver.find_element_by_accessibility_id("Image (Zoom and Pinch)").click()
		self.driver.find_element_by_accessibility_id("Test Gesture").click()
		# 选取两个点
		action1 = TouchAction(self.driver)
		action1.press(x=87, y=150).move_to(x=45, y=150).release()
		action2 = TouchAction(self.driver)
		action2.press(x=120, y=150).move_to(x=150, y=150).release()
		# action2.press(x=200, y=150).move_to(x=280, y=150).release() # 无法执行
		ma = MultiAction(self.driver)
		ma.add(action1, action2)
		ma.perform()
		sleep(5)
开发者ID:huajie1,项目名称:appium_ios,代码行数:17,代码来源:l6_personal_zoom_image.py

示例7: test_multitouch

# 需要导入模块: from appium.webdriver.common.multi_action import MultiAction [as 别名]
# 或者: from appium.webdriver.common.multi_action.MultiAction import add [as 别名]
 def test_multitouch(self):
     driver = self.driver
     driver.implicitly_wait(90)
     
     action1 = TouchAction(driver)
     action1.long_press(None,1181,665).wait(500).release()
     
     action2 = TouchAction(driver)
     action2.long_press(None,838,1104).wait(500).release()
     
     action3 = TouchAction(driver)
     action3.long_press(None,588,1652).wait(500).release()
     
     multi = MultiAction(driver)
     multi.add(action1,action2,action3)
     multi.perform()
开发者ID:vijaynirmal,项目名称:AppiumJenkinsIntegration,代码行数:18,代码来源:MultoTouch.py

示例8: test_actions_with_waits

# 需要导入模块: from appium.webdriver.common.multi_action import MultiAction [as 别名]
# 或者: from appium.webdriver.common.multi_action.MultiAction import add [as 别名]
    def test_actions_with_waits(self):
        el1 = self.driver.find_element_by_accessibility_id('Content')
        el2 = self.driver.find_element_by_accessibility_id('Animation')
        self.driver.scroll(el1, el2)

        el = self.driver.find_element_by_accessibility_id('Views')
        action = TouchAction(self.driver)
        action.tap(el).perform()

        # simulate a swipe/scroll
        el = wait_for_element(self.driver, MobileBy.ACCESSIBILITY_ID, 'Expandable Lists')
        action.press(el).move_to(x=100, y=-1000).release().perform()
        el = self.driver.find_element_by_accessibility_id('Layouts')
        action.press(el).move_to(x=100, y=-1000).release().perform()

        el = self.driver.find_element_by_accessibility_id('Splitting Touches across Views')
        action.tap(el).perform()

        wait_for_element(self.driver, MobileBy.CLASS_NAME, 'android.widget.ListView')
        els = self.driver.find_elements_by_class_name('android.widget.ListView')
        a1 = TouchAction()
        a1.press(els[0]) \
            .move_to(x=10, y=0) \
            .move_to(x=10, y=-75) \
            .wait(1000) \
            .move_to(x=10, y=-600) \
            .release()

        a2 = TouchAction()
        a2.press(els[1]) \
            .move_to(x=10, y=10) \
            .move_to(x=10, y=-300) \
            .wait(500) \
            .move_to(x=10, y=-600) \
            .release()

        ma = MultiAction(self.driver, els[0])
        ma.add(a1, a2)
        ma.perform()
开发者ID:appium,项目名称:python-client,代码行数:41,代码来源:multi_action_tests.py

示例9: test_smiley_face

# 需要导入模块: from appium.webdriver.common.multi_action import MultiAction [as 别名]
# 或者: from appium.webdriver.common.multi_action.MultiAction import add [as 别名]
    def test_smiley_face(self):
        # just for the fun of it.
        # this doesn't really assert anything.
        self.driver.find_element_by_accessibility_id('Graphics').click()

        els = self.driver.find_elements_by_class_name('android.widget.TextView')
        self.driver.scroll(els[len(els)-1], els[0])

        el = None
        try:
            el = self.driver.find_element_by_accessibility_id('Touch Paint')
        except Exception as e:
            els = self.driver.find_elements_by_class_name('android.widget.TextView')
            self.driver.scroll(els[len(els)-1], els[0])

        if el is None:
            el = self.driver.find_element_by_accessibility_id('Touch Paint')

        el.click()

        # paint
        e1 = TouchAction()
        e1.press(x=150, y=100).release()

        e2 = TouchAction()
        e2.press(x=250, y=100).release()

        smile = TouchAction()
        smile.press(x=110, y=200) \
            .move_to(x=1, y=1) \
            .move_to(x=1, y=1) \
            .move_to(x=1, y=1) \
            .move_to(x=1, y=1) \
            .move_to(x=1, y=1) \
            .move_to(x=2, y=1) \
            .move_to(x=2, y=1) \
            .move_to(x=2, y=1) \
            .move_to(x=2, y=1) \
            .move_to(x=2, y=1) \
            .move_to(x=3, y=1) \
            .move_to(x=3, y=1) \
            .move_to(x=3, y=1) \
            .move_to(x=3, y=1) \
            .move_to(x=3, y=1) \
            .move_to(x=4, y=1) \
            .move_to(x=4, y=1) \
            .move_to(x=4, y=1) \
            .move_to(x=4, y=1) \
            .move_to(x=4, y=1) \
            .move_to(x=5, y=1) \
            .move_to(x=5, y=1) \
            .move_to(x=5, y=1) \
            .move_to(x=5, y=1) \
            .move_to(x=5, y=1) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=-1) \
            .move_to(x=5, y=-1) \
            .move_to(x=5, y=-1) \
            .move_to(x=5, y=-1) \
            .move_to(x=5, y=-1) \
            .move_to(x=4, y=-1) \
            .move_to(x=4, y=-1) \
            .move_to(x=4, y=-1) \
            .move_to(x=4, y=-1) \
            .move_to(x=4, y=-1) \
            .move_to(x=3, y=-1) \
            .move_to(x=3, y=-1) \
            .move_to(x=3, y=-1) \
            .move_to(x=3, y=-1) \
            .move_to(x=3, y=-1) \
            .move_to(x=2, y=-1) \
            .move_to(x=2, y=-1) \
            .move_to(x=2, y=-1) \
            .move_to(x=2, y=-1) \
            .move_to(x=2, y=-1) \
            .move_to(x=1, y=-1) \
            .move_to(x=1, y=-1) \
            .move_to(x=1, y=-1) \
            .move_to(x=1, y=-1) \
            .move_to(x=1, y=-1)
        smile.release()

        ma = MultiAction(self.driver)
        ma.add(e1, e2, smile)
        ma.perform()

        # so you can see it
        sleep(10)
开发者ID:ankcrimson,项目名称:Practice,代码行数:97,代码来源:android_complex.py

示例10: test_smiley_face

# 需要导入模块: from appium.webdriver.common.multi_action import MultiAction [as 别名]
# 或者: from appium.webdriver.common.multi_action.MultiAction import add [as 别名]
    def test_smiley_face(self):
        # just for the fun of it.
        # this doesn't really assert anything.
        # paint
        eye1 = TouchAction()
        eye1.press(x=150, y=100).release()

        eye2 = TouchAction()
        eye2.press(x=250, y=100).release()

        smile = TouchAction()
        smile.press(x=110, y=200) \
            .move_to(x=1, y=1) \
            .move_to(x=1, y=1) \
            .move_to(x=1, y=1) \
            .move_to(x=1, y=1) \
            .move_to(x=1, y=1) \
            .move_to(x=2, y=1) \
            .move_to(x=2, y=1) \
            .move_to(x=2, y=1) \
            .move_to(x=2, y=1) \
            .move_to(x=2, y=1) \
            .move_to(x=3, y=1) \
            .move_to(x=3, y=1) \
            .move_to(x=3, y=1) \
            .move_to(x=3, y=1) \
            .move_to(x=3, y=1) \
            .move_to(x=4, y=1) \
            .move_to(x=4, y=1) \
            .move_to(x=4, y=1) \
            .move_to(x=4, y=1) \
            .move_to(x=4, y=1) \
            .move_to(x=5, y=1) \
            .move_to(x=5, y=1) \
            .move_to(x=5, y=1) \
            .move_to(x=5, y=1) \
            .move_to(x=5, y=1) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=-1) \
            .move_to(x=5, y=-1) \
            .move_to(x=5, y=-1) \
            .move_to(x=5, y=-1) \
            .move_to(x=5, y=-1) \
            .move_to(x=4, y=-1) \
            .move_to(x=4, y=-1) \
            .move_to(x=4, y=-1) \
            .move_to(x=4, y=-1) \
            .move_to(x=4, y=-1) \
            .move_to(x=3, y=-1) \
            .move_to(x=3, y=-1) \
            .move_to(x=3, y=-1) \
            .move_to(x=3, y=-1) \
            .move_to(x=3, y=-1) \
            .move_to(x=2, y=-1) \
            .move_to(x=2, y=-1) \
            .move_to(x=2, y=-1) \
            .move_to(x=2, y=-1) \
            .move_to(x=2, y=-1) \
            .move_to(x=1, y=-1) \
            .move_to(x=1, y=-1) \
            .move_to(x=1, y=-1) \
            .move_to(x=1, y=-1) \
            .move_to(x=1, y=-1)
        smile.release()

        ma = MultiAction(self.driver)
        ma.add(eye1, eye2, smile)
        ma.perform()

        # so you can see it
        sleep(10)
开发者ID:12301146-hongchaodai,项目名称:sample-code,代码行数:80,代码来源:android_gestures_sauce.py

示例11: test_scroll

# 需要导入模块: from appium.webdriver.common.multi_action import MultiAction [as 别名]
# 或者: from appium.webdriver.common.multi_action.MultiAction import add [as 别名]
    def test_scroll(self):
        sleep(2)
        els = self.driver.find_element_by_class_name('android.widget.ImageButton')
        els.click()
        sleep(10)
        
        
        
        btn = self.driver.find_element_by_class_name('android.webkit.WebView')
        btn.click()


        sleep(10)

        webview = self.driver.contexts
        print ('>>%s<<' % len(webview))
        contexts = self.driver.contexts
        self.driver.switch_to.context('WEBVIEW')

        e1 = TouchAction()
        e1.press(x=150, y=100).release()

        e2 = TouchAction()
        e2.press(x=250, y=100).release()


        smile = TouchAction()
        smile.press(x=400, y=800) \
            .move_to(x=-1, y=1) \
            .move_to(x=-1, y=1) \
            .move_to(x=-1, y=1) \
            .move_to(x=-1, y=1) \
            .move_to(x=-1, y=1) \
            .move_to(x=-2, y=1) \
            .move_to(x=-2, y=1) \
            .move_to(x=-2, y=1) \
            .move_to(x=-2, y=1) \
            .move_to(x=-2, y=1) \
            .move_to(x=-3, y=1) \
            .move_to(x=-3, y=1) \
            .move_to(x=-3, y=1) \
            .move_to(x=-3, y=1) \
            .move_to(x=-3, y=1) \
            .move_to(x=-4, y=1) \
            .move_to(x=-4, y=1) \
            .move_to(x=-4, y=1) \
            .move_to(x=-4, y=1) \
            .move_to(x=-4, y=1) \
            .move_to(x=-5, y=1) \
            .move_to(x=-5, y=1) \
            .move_to(x=-5, y=1) \
            .move_to(x=-5, y=1) \
            .move_to(x=-5, y=1) \
            .move_to(x=-5, y=0) \
            .move_to(x=-5, y=0) \
            .move_to(x=-5, y=0) \
            .move_to(x=-5, y=0) \
            .move_to(x=-5, y=0) \
            .move_to(x=-5, y=0) \
            .move_to(x=-5, y=0) \
            .move_to(x=-5, y=0) \
            .move_to(x=-5, y=-1) \
            .move_to(x=-5, y=-1) \
            .move_to(x=-5, y=-1) \
            .move_to(x=-5, y=-1) \
            .move_to(x=-5, y=-1) \
            .move_to(x=-4, y=-1) \
            .move_to(x=-4, y=-1) \
            .move_to(x=-4, y=-1) \
            .move_to(x=-4, y=-1) \
            .move_to(x=-4, y=-1) \
            .move_to(x=-3, y=-1) \
            .move_to(x=-3, y=-1) \
            .move_to(x=-3, y=-1) \
            .move_to(x=-3, y=-1) \
            .move_to(x=-3, y=-1) \
            .move_to(x=-2, y=-1) \
            .move_to(x=-2, y=-1) \
            .move_to(x=-2, y=-1) \
            .move_to(x=-2, y=-1) \
            .move_to(x=-2, y=-1) \
            .move_to(x=-1, y=-1) \
            .move_to(x=-1, y=-1) \
            .move_to(x=-1, y=-1) \
            .move_to(x=-1, y=-1) \
            .move_to(x=-1, y=-1)
        smile.release()
        ma = MultiAction(self.driver)
        ma.add(e1,e2,smile)
        ma.perform()
        sleep(10)
开发者ID:ankcrimson,项目名称:NikeAutomation,代码行数:93,代码来源:android_selendroid.py

示例12: test_scroll

# 需要导入模块: from appium.webdriver.common.multi_action import MultiAction [as 别名]
# 或者: from appium.webdriver.common.multi_action.MultiAction import add [as 别名]
    def test_scroll(self):
        sleep(2)
        els = self.driver.find_element_by_class_name('android.widget.ImageButton')
        els.click()
        sleep(10)
        
        
        
        #btn = self.driver.find_element_by_class_name('android.webkit.WebView')
        #btn.click()


        #
        selfview = self.driver.contexts[0]
        webview = self.driver.contexts[1]
        print ('>>%s<<' % webview)
        #contexts = self.driver.contexts

        self.driver.switch_to.context(webview)
        self.driver.get("http://m.nike.com/us/en_us/pd/air-zoom-pegasus-32-running-shoe/pid-10294427/pgid-10266840")

        sleep(10)

        print ('>>%s<<' % selfview)
        self.driver.switch_to.context(selfview)
        



        print ('Now trying TouchAction')
        e1 = TouchAction()
        e1.press(x=150, y=100).release()

        e2 = TouchAction()
        e2.press(x=250, y=100).release()


        smile = TouchAction()
        smile.press(x=400, y=800) \
            .move_to(x=-1, y=1) \
            .move_to(x=-1, y=1) \
            .move_to(x=-1, y=1) \
            .move_to(x=-1, y=1) \
            .move_to(x=-1, y=1) \
            .move_to(x=-2, y=1) \
            .move_to(x=-2, y=1) \
            .move_to(x=-2, y=1) \
            .move_to(x=-2, y=1) \
            .move_to(x=-2, y=1) \
            .move_to(x=-3, y=1) \
            .move_to(x=-3, y=1) \
            .move_to(x=-3, y=1) \
            .move_to(x=-3, y=1) \
            .move_to(x=-3, y=1) \
            .move_to(x=-4, y=1) \
            .move_to(x=-4, y=1) \
            .move_to(x=-4, y=1) \
            .move_to(x=-4, y=1) \
            .move_to(x=-4, y=1) \
            .move_to(x=-5, y=1) \
            .move_to(x=-5, y=1) \
            .move_to(x=-5, y=1) \
            .move_to(x=-5, y=1) \
            .move_to(x=-5, y=1) \
            .move_to(x=-5, y=0) \
            .move_to(x=-5, y=0) \
            .move_to(x=-5, y=0) \
            .move_to(x=-5, y=0) \
            .move_to(x=-5, y=0) \
            .move_to(x=-5, y=0) \
            .move_to(x=-5, y=0) \
            .move_to(x=-5, y=0) \
            .move_to(x=-5, y=-1) \
            .move_to(x=-5, y=-1) \
            .move_to(x=-5, y=-1) \
            .move_to(x=-5, y=-1) \
            .move_to(x=-5, y=-1) \
            .move_to(x=-4, y=-1) \
            .move_to(x=-4, y=-1) \
            .move_to(x=-4, y=-1) \
            .move_to(x=-4, y=-1) \
            .move_to(x=-4, y=-1) \
            .move_to(x=-3, y=-1) \
            .move_to(x=-3, y=-1) \
            .move_to(x=-3, y=-1) \
            .move_to(x=-3, y=-1) \
            .move_to(x=-3, y=-1) \
            .move_to(x=-2, y=-1) \
            .move_to(x=-2, y=-1) \
            .move_to(x=-2, y=-1) \
            .move_to(x=-2, y=-1) \
            .move_to(x=-2, y=-1) \
            .move_to(x=-1, y=-1) \
            .move_to(x=-1, y=-1) \
            .move_to(x=-1, y=-1) \
            .move_to(x=-1, y=-1) \
            .move_to(x=-1, y=-1)
        smile.release()
        ma = MultiAction(self.driver)
        ma.add(e1,e2,smile)
#.........这里部分代码省略.........
开发者ID:ankcrimson,项目名称:NikeAutomation,代码行数:103,代码来源:android_selendroid_v2.py

示例13: test_find_elements

# 需要导入模块: from appium.webdriver.common.multi_action import MultiAction [as 别名]
# 或者: from appium.webdriver.common.multi_action.MultiAction import add [as 别名]
    def test_find_elements(self):
        # pause a moment, so xml generation can occur
        sleep(2)

        self.driver.get("http://m.nike.com/us/en_us/pd/air-zoom-pegasus-32-running-shoe/pid-10294427/pgid-10266840")
        #els = self.driver.find_elements_by_xpath('//android.widget.TextView')
        #Eself.assertEqual('API Demos', els[0].text)

        #el = self.driver.find_element_by_xpath('//android.widget.TextView[contains(@text, "Animat")]')
        #self.assertEqual('Animation', el.text)

        #el = self.driver.find_element_by_accessibility_id("App")
        #el.click()

        #els = self.driver.find_elements_by_android_uiautomator('new UiSelector().clickable(true)')
        # there are more, but at least 10 visible
        #self.assertLess(10, len(els))
        # the list includes 2 before the main visible elements
        #self.assertEqual('Action Bar', els[2].text)

        #els = self.driver.find_elements_by_xpath('//android.widget.TextView')
        #self.assertLess(10, len(els))
        #self.assertEqual('Action Bar', els[1].text)
        smile = TouchAction()
        smile.press(x=110, y=200) \
            .move_to(x=1, y=1) \
            .move_to(x=1, y=1) \
            .move_to(x=1, y=1) \
            .move_to(x=1, y=1) \
            .move_to(x=1, y=1) \
            .move_to(x=2, y=1) \
            .move_to(x=2, y=1) \
            .move_to(x=2, y=1) \
            .move_to(x=2, y=1) \
            .move_to(x=2, y=1) \
            .move_to(x=3, y=1) \
            .move_to(x=3, y=1) \
            .move_to(x=3, y=1) \
            .move_to(x=3, y=1) \
            .move_to(x=3, y=1) \
            .move_to(x=4, y=1) \
            .move_to(x=4, y=1) \
            .move_to(x=4, y=1) \
            .move_to(x=4, y=1) \
            .move_to(x=4, y=1) \
            .move_to(x=5, y=1) \
            .move_to(x=5, y=1) \
            .move_to(x=5, y=1) \
            .move_to(x=5, y=1) \
            .move_to(x=5, y=1) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=0) \
            .move_to(x=5, y=-1) \
            .move_to(x=5, y=-1) \
            .move_to(x=5, y=-1) \
            .move_to(x=5, y=-1) \
            .move_to(x=5, y=-1) \
            .move_to(x=4, y=-1) \
            .move_to(x=4, y=-1) \
            .move_to(x=4, y=-1) \
            .move_to(x=4, y=-1) \
            .move_to(x=4, y=-1) \
            .move_to(x=3, y=-1) \
            .move_to(x=3, y=-1) \
            .move_to(x=3, y=-1) \
            .move_to(x=3, y=-1) \
            .move_to(x=3, y=-1) \
            .move_to(x=2, y=-1) \
            .move_to(x=2, y=-1) \
            .move_to(x=2, y=-1) \
            .move_to(x=2, y=-1) \
            .move_to(x=2, y=-1) \
            .move_to(x=1, y=-1) \
            .move_to(x=1, y=-1) \
            .move_to(x=1, y=-1) \
            .move_to(x=1, y=-1) \
            .move_to(x=1, y=-1)
        smile.release()

        ma = MultiAction(self.driver)
        ma.add(smile)
        ma.perform()

        # so you can see it
        sleep(10)
开发者ID:ankcrimson,项目名称:NikeAutomation,代码行数:93,代码来源:browser_gestures.py


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