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


Python Actions.press方法代码示例

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


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

示例1: move_seek_slider

# 需要导入模块: from marionette_driver.marionette import Actions [as 别名]
# 或者: from marionette_driver.marionette.Actions import press [as 别名]
 def move_seek_slider(self, offset):
     scale = self.marionette.find_element(*self._video_seek_head_locator)
     finger = Actions(self.marionette)
     finger.press(scale)
     finger.move_by_offset(offset, 0)
     finger.release()
     finger.perform()
开发者ID:adrm,项目名称:gaia,代码行数:9,代码来源:fullscreen_video.py

示例2: edge_scroll

# 需要导入模块: from marionette_driver.marionette import Actions [as 别名]
# 或者: from marionette_driver.marionette.Actions import press [as 别名]
    def edge_scroll(self, frame, direction, dist, release=True):
        """edge scroll - performs task switching action.

        direction = 'LtoR' or 'RtoL' (finger movement direction)
        dist = percentage of horizontal distance travel, max is 1.0
        release = if set to False, the Action object will be returned so the user can complete the release action"""

        start_x = 0
        dist_travelled = 0
        time_increment = 0.01

        if dist > 1:
            dist = 1
        if direction == 'LtoR':
            start_x = 0
        elif direction == 'RtoL':
            start_x = frame.size['width']
            dist *= -1  # travel opposite direction

        limit = dist * frame.size['width']
        dist_unit = limit * time_increment

        action = Actions(self.marionette)
        action.press(frame, start_x, frame.size['height'] / 2)  # press either the left or right edge

        while abs(dist_travelled) < abs(limit):
            action.move_by_offset(dist_unit, 0)
            action.wait(time_increment)
            dist_travelled += dist_unit
        if release:
            action.release()
        action.perform()

        return action
开发者ID:Anirudh0,项目名称:gaia,代码行数:36,代码来源:gaia_graphics_test.py

示例3: wait

# 需要导入模块: from marionette_driver.marionette import Actions [as 别名]
# 或者: from marionette_driver.marionette.Actions import press [as 别名]
def wait(marionette, wait_for_condition, expected):
    testAction = marionette.absolute_url("testAction.html")
    marionette.navigate(testAction)
    action = Actions(marionette)
    button = marionette.find_element(By.ID, "button1")
    action.press(button).wait().release().perform()
    wait_for_condition_else_raise(marionette, wait_for_condition, expected, "return document.getElementById('button1').innerHTML;")
开发者ID:luke-chang,项目名称:gecko-1,代码行数:9,代码来源:single_finger_functions.py

示例4: send

# 需要导入模块: from marionette_driver.marionette import Actions [as 别名]
# 或者: from marionette_driver.marionette.Actions import press [as 别名]
    def send(self, string):
        self.switch_to_keyboard()
        for val in string:
            if ord(val) > 127:
                # this would get the right key to long press and switch to the right keyboard
                middle_key_val = self._find_key_for_longpress(val.encode("UTF-8"))
                self._switch_to_correct_layout(middle_key_val)

                # find the key to long press and press it to get the extended characters list
                middle_key = self.marionette.find_element(*self._key_locator(middle_key_val))
                action = Actions(self.marionette)
                action.press(middle_key).wait(1).perform()

                # find the targeted extended key to send
                key = Wait(self.marionette).until(expected.element_present(*self._key_locator(val)))
                Wait(self.marionette).until(expected.element_displayed(key))
                action.move(key).release().perform()
            else:
                # after switching to correct keyboard, tap/click if the key is there
                self._switch_to_correct_layout(val)
                self._tap(val)

                # when we tap on '@' the layout switches to the default keyboard - Bug 996332
                if val == "@":
                    Wait(self.marionette).until(lambda m: self._layout_page == 0)

        self.apps.switch_to_displayed_app()
开发者ID:nullaus,项目名称:gaia,代码行数:29,代码来源:app.py

示例5: move_slider

# 需要导入模块: from marionette_driver.marionette import Actions [as 别名]
# 或者: from marionette_driver.marionette.Actions import press [as 别名]
 def move_slider(self, slider, dir_x):
     scale = self.marionette.find_element(*slider)
     finger = Actions(self.marionette)
     finger.press(scale)
     finger.move_by_offset(dir_x, 0)
     finger.release()
     finger.perform()
     time.sleep(2)
开发者ID:AndersonFurlane,项目名称:gaia,代码行数:10,代码来源:edit_picture_base.py

示例6: move_element_offset

# 需要导入模块: from marionette_driver.marionette import Actions [as 别名]
# 或者: from marionette_driver.marionette.Actions import press [as 别名]
def move_element_offset(marionette, wait_for_condition, expected1, expected2):
    testAction = marionette.absolute_url("testAction.html")
    marionette.navigate(testAction)
    ele = marionette.find_element(By.ID, "button1")
    action = Actions(marionette)
    action.press(ele).move_by_offset(0,150).move_by_offset(0, 150).release()
    action.perform()
    wait_for_condition_else_raise(marionette, wait_for_condition, expected1, "return document.getElementById('button1').innerHTML;")
    wait_for_condition_else_raise(marionette, wait_for_condition, expected2, "return document.getElementById('button2').innerHTML;")
开发者ID:luke-chang,项目名称:gecko-1,代码行数:11,代码来源:single_finger_functions.py

示例7: context_menu

# 需要导入模块: from marionette_driver.marionette import Actions [as 别名]
# 或者: from marionette_driver.marionette.Actions import press [as 别名]
def context_menu(marionette, wait_for_condition, expected1, expected2):
    testAction = marionette.absolute_url("testAction.html")
    marionette.navigate(testAction)
    button = marionette.find_element("id", "button1")
    action = Actions(marionette)
    action.press(button).wait(5).perform()
    wait_for_condition_else_raise(marionette, wait_for_condition, expected1, "return document.getElementById('button1').innerHTML;")
    action.release().perform()
    wait_for_condition_else_raise(marionette, wait_for_condition, expected2, "return document.getElementById('button1').innerHTML;")
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:11,代码来源:single_finger_functions.py

示例8: chain

# 需要导入模块: from marionette_driver.marionette import Actions [as 别名]
# 或者: from marionette_driver.marionette.Actions import press [as 别名]
def chain(marionette, wait_for_condition, expected1, expected2):
    testAction = marionette.absolute_url("testAction.html")
    marionette.navigate(testAction)
    marionette.timeout.implicit = 15
    action = Actions(marionette)
    button1 = marionette.find_element(By.ID, "button1")
    action.press(button1).perform()
    button2 = marionette.find_element(By.ID, "delayed")
    wait_for_condition_else_raise(marionette, wait_for_condition, expected1, "return document.getElementById('button1').innerHTML;")
    action.move(button2).release().perform()
    wait_for_condition_else_raise(marionette, wait_for_condition, expected2, "return document.getElementById('delayed').innerHTML;")
开发者ID:luke-chang,项目名称:gecko-1,代码行数:13,代码来源:single_finger_functions.py

示例9: press_release

# 需要导入模块: from marionette_driver.marionette import Actions [as 别名]
# 或者: from marionette_driver.marionette.Actions import press [as 别名]
def press_release(marionette, times, wait_for_condition, expected):
    testAction = marionette.absolute_url("testAction.html")
    marionette.navigate(testAction)
    action = Actions(marionette)
    button = marionette.find_element(By.ID, "button1")
    action.press(button).release()
    # Insert wait between each press and release chain.
    for _ in range(times-1):
        action.wait(0.1)
        action.press(button).release()
    action.perform()
    wait_for_condition_else_raise(marionette, wait_for_condition, expected, "return document.getElementById('button1').innerHTML;")
开发者ID:luke-chang,项目名称:gecko-1,代码行数:14,代码来源:single_finger_functions.py

示例10: switch_keyboard_language

# 需要导入模块: from marionette_driver.marionette import Actions [as 别名]
# 或者: from marionette_driver.marionette.Actions import press [as 别名]
    def switch_keyboard_language(self, lang_code):
        # TODO At the moment this doesn't work because the UI has changed
        # An attempted repair ran into https://bugzilla.mozilla.org/show_bug.cgi?id=779284 (Modal dialog)

        keyboard_language_locator = (By.CSS_SELECTOR, ".keyboard-row button[data-keyboard='%s']" % lang_code)

        self.switch_to_keyboard()
        language_key = self.marionette.find_element(*self._language_key_locator)
        action = Actions(self.marionette)
        action.press(language_key).wait(1).perform()
        target_kb_layout = self.marionette.find_element(*keyboard_language_locator)
        action.move(target_kb_layout).release().perform()
        self.apps.switch_to_displayed_app()
开发者ID:nullaus,项目名称:gaia,代码行数:15,代码来源:app.py

示例11: test_move_offset_element

# 需要导入模块: from marionette_driver.marionette import Actions [as 别名]
# 或者: from marionette_driver.marionette.Actions import press [as 别名]
 def test_move_offset_element(self):
   testAction = self.marionette.absolute_url("testAction.html")
   self.marionette.navigate(testAction)
   start = self.marionette.find_element("id", "button1")
   ele = self.marionette.find_element("id", "button3")
   multi_action = MultiActions(self.marionette)
   action1 = Actions(self.marionette)
   action2 = Actions(self.marionette)
   action1.press(start).move_by_offset(0,300).wait().release()
   action2.press(ele).wait(5).release()
   multi_action.add(action1).add(action2).perform()
   expected = "button1-touchstart"
   self.wait_for_condition(lambda m: m.execute_script("return document.getElementById('button1').innerHTML;") == expected)
   self.assertEqual("button2-touchmove-touchend", self.marionette.execute_script("return document.getElementById('button2').innerHTML;"))
   self.assertTrue("button3-touchstart-touchend" in self.marionette.execute_script("return document.getElementById('button3').innerHTML;"))
开发者ID:stefanie-cliqz,项目名称:browser-f,代码行数:17,代码来源:test_multi_finger.py

示例12: choose_extended_character

# 需要导入模块: from marionette_driver.marionette import Actions [as 别名]
# 或者: from marionette_driver.marionette.Actions import press [as 别名]
    def choose_extended_character(self, long_press_key, selection, movement=True):
        self.switch_to_keyboard()
        action = Actions(self.marionette)

        # after switching to correct keyboard, set long press if the key is there
        self._switch_to_correct_layout(long_press_key)
        key = Wait(self.marionette).until(expected.element_present(*self._key_locator(long_press_key)))
        Wait(self.marionette).until(expected.element_displayed(key))
        action.press(key).wait(1).perform()

        # find the extended key and perform the action chain
        extend_keys = self.marionette.find_elements(*self._highlight_key_locator)
        if movement is True:
            action.move(extend_keys[selection - 1]).perform()
        action.release().perform()

        self.apps.switch_to_displayed_app()
开发者ID:nullaus,项目名称:gaia,代码行数:19,代码来源:app.py

示例13: test_three_fingers

# 需要导入模块: from marionette_driver.marionette import Actions [as 别名]
# 或者: from marionette_driver.marionette.Actions import press [as 别名]
 def test_three_fingers(self):
   testAction = self.marionette.absolute_url("testAction.html")
   self.marionette.navigate(testAction)
   start_one = self.marionette.find_element("id", "button1")
   start_two = self.marionette.find_element("id", "button2")
   element1 = self.marionette.find_element("id", "button3")
   element2 = self.marionette.find_element("id", "button4")
   multi_action = MultiActions(self.marionette)
   action1 = Actions(self.marionette)
   action2 = Actions(self.marionette)
   action3 = Actions(self.marionette)
   action1.press(start_one).move_by_offset(0,300).release()
   action2.press(element1).wait().wait(5).release()
   action3.press(element2).wait().wait().release()
   multi_action.add(action1).add(action2).add(action3).perform()
   expected = "button1-touchstart"
   self.wait_for_condition(lambda m: m.execute_script("return document.getElementById('button1').innerHTML;") == expected)
   self.assertEqual("button2-touchmove-touchend", self.marionette.execute_script("return document.getElementById('button2').innerHTML;"))
   button3_text = self.marionette.execute_script("return document.getElementById('button3').innerHTML;")
   button4_text = self.marionette.execute_script("return document.getElementById('button4').innerHTML;")
   self.assertTrue("button3-touchstart-touchend" in button3_text)
   self.assertTrue("button4-touchstart-touchend" in button4_text)
   self.assertTrue(int(button3_text.rsplit("-")[-1]) >= 5000)
   self.assertTrue(int(button4_text.rsplit("-")[-1]) >= 5000)
开发者ID:stefanie-cliqz,项目名称:browser-f,代码行数:26,代码来源:test_multi_finger.py

示例14: EverythingMe

# 需要导入模块: from marionette_driver.marionette import Actions [as 别名]
# 或者: from marionette_driver.marionette.Actions import press [as 别名]
class EverythingMe(object):

    def __init__(self, p_parent):
        self.apps = p_parent.apps
        self.data_layer = p_parent.data_layer
        self.parent = p_parent
        self.marionette = p_parent.marionette
        self.UTILS = p_parent.UTILS
        self.actions = Actions(self.marionette)

    def launch(self):
        self.apps.kill_all()

        # If EME has already been launched, then the DOM has changed.
        self.UTILS.reporting.logResult("info", "Launching Everything ME.")
        boolOK = False
        try:
            self.parent.wait_for_element_displayed(*DOM.EME.start_eme_icon, timeout=1)
            x = self.marionette.find_element(*DOM.EME.start_eme_icon)
            x.tap()
            boolOK = True
        except:
            self.UTILS.reporting.logResult("info", "Everything ME is already 'running', so just waking it up ...")
            self._relaunch()
            try:
                self.parent.wait_for_element_displayed(*DOM.EME.groups, timeout=3)
            except:
                self._relaunch()
            boolOK = True

        self.UTILS.test.test(boolOK, "EME Starting up ...")

    def _relaunch(self):
        """
        Private function to re-launch.
        This gets complicated:
        1. el.tap() and el.click() only work *sometimes*, so use the keyboard to relaunch.
        2. Sometimes the messges app randomly launches instead of evme!
        """
        x = self.marionette.find_element(*DOM.EME.search_field)
        x.send_keys("waking up evme")

        x = self.marionette.find_element(*DOM.EME.search_clear)
        x.tap()

    def add_app_to_homescreen(self, name):
        """
        Pick an app from the apps listed in this group.
        """
        x = self.UTILS.element.getElementByXpath(DOM.EME.app_to_install.format(name))
        app_name = x.text
        self.UTILS.reporting.logResult("debug", "icon displayed: {}".format(x.is_displayed()))
        time.sleep(2)

        self.UTILS.test.test(app_name == name, "" + app_name + "'is the correct app", True)

        self.actions.long_press(x, 2).perform()

        x = self.UTILS.element.getElement(DOM.EME.add_to_homescreen_btn, "Add app to homescreen button")
        x.tap()
        time.sleep(2)

        return True

    def add_group(self, group):
        """
        Adds a group to EME (assumes you're already in the EME group screen).
        """
        self.UTILS.reporting.logResult("info", "(Adding group '" + group + "'.)")

        # Click the 'More' icon.
        x = self.UTILS.element.getElement(DOM.EME.add_group_button, "'More' icon")
        x.tap()

        # Wait for the 'loading' spinner to go away (can take a while!).
        self.UTILS.element.waitForNotElements(DOM.EME.loading_groups_message, "'Loading' message", True, 120)

        # Chose an item from the groups list...
        self.UTILS.general.selectFromSystemDialog(group)

        # Verify the new group is in the groups list.
        x = self.UTILS.element.getElements(DOM.EME.groups, "Groups")
        boolOK = False
        for i in x:
            if i.get_attribute("data-query") == group:
                boolOK = True
                break

        self.UTILS.test.test(boolOK, "New group '" + group + "' is now present in the EME groups.")
        return boolOK

    def add_multiple_groups(self, group_array=False):
        """
        Adds multiple groups based on an array of numbers (defaults to all available groups).
        <br><br>
        For example: add_multiple_groups([0,1,2,3,8,11]) ... or just: add_multiple_groups()
        """
        x = self.UTILS.element.getElement(DOM.EME.add_group_button, "'More' icon")
        x.tap()
        self.UTILS.element.waitForNotElements(DOM.EME.loading_groups_message, "'Loading' message", True, 120)
#.........这里部分代码省略.........
开发者ID:owdqa,项目名称:OWD_TEST_TOOLKIT,代码行数:103,代码来源:everythingme.py


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